Subject: Re: build error in icmp6.c
To: Todd Vierling <tv@pobox.com>
From: Richard Earnshaw <rearnsha@arm.com>
List: current-users
Date: 06/13/2000 18:28:03
tv@pobox.com said:
> - for the best-case workaround, cast these to `int' before checking if
> they
> are less than 0 (...do not cast to `signed char').
This won't help.
f.c:
main()
{
char a = 0xf0;
printf("%d\n", (int) a);
}
$ gcc -funsigned-char f.c
$ ./a.out
240
You need to cast the char to signed before you can then sign-extend it to
an int.