On Fri, 12 May 2000 16:26:01 +0800, zhu qun ying wrote:
> consider this simple program:
> int
> main(void)
> {
>     char i = -1;
>     printf("%d\n", i);
>     return 0;
> }
> 
> The print out is 255 in stead of -1, unless I define i as
> signed char i;
> then I get the "-1" print out.

You do know how to get in trouble... ;-)

> I know the compiler is free to implement char as signed or unsigned or "pseudo
> unsigned" according to the standard. But as gcc is treating char as signed char
> for other platforms, I wonder is this a special treatment for StronARM? Is it a
> bug in GCC? Or my assumsion of gcc will treat char as signed for all platform
> is simply wrong. Should it behaves consistently across platforms?

No. This is the output on an SGI Onyx2 (Mips R12000 CPU) running IRIX 6.5 with
gcc 2.95.2 as compiler:

  erik@lumiere:/tmp >uname -a
  IRIX64 lumiere 6.5 10181058 IP27
  erik@lumiere:/tmp >gcc --version
  2.95.2
  erik@lumiere:/tmp >gcc -Wall -o foo foo.c
  foo.c: In function `main':
  foo.c:5: warning: implicit declaration of function `printf'
  erik@lumiere:/tmp >./foo 
  255

AFAIK as I know gcc is compliant with the platform's native compiler, not
with itself.


PLEASE don't send followups to the LART list because it is completely
off-topic on that list.



Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2783635  Fax: +31-15-2781843  Email: [EMAIL PROTECTED]
WWW: http://www-ict.its.tudelft.nl/~erik/




unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]
++        Please use [EMAIL PROTECTED] for           ++
++                        kernel-related discussions.                      ++

Reply via email to