Why isn't -funsigned-char working?
Rob Landley
rob at landley.net
Tue Apr 18 22:25:58 UTC 2006
On Monday 17 April 2006 10:37 pm, Rich Felker wrote:
> On Mon, Apr 17, 2006 at 09:40:13PM -0400, Rob Landley wrote:
> > We're feeding in -funsigned-char, I can see it on the command line when I
> > go V=1. And yet, when I go:
> >
> > char c=255;
> > printf("%d",c);
> >
> > I get -1. Why is that?
>
> With -funsigned-char? It prints 255 for me with -funsigned-char and -1
> without, which is the expected behavior.
going "gcc -funsigned-char hello.c" works, sure. But something in the 800
options our build system is supplying seems to be switching it off:
gcc -I/home/landley/busybox/busybox/include
-I/home/landley/busybox/busybox/include -I -funsigned-char
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall
-Wstrict-prototypes -Wshadow -Os -march=i386 -mpreferred-stack-boundary=2
-falign-functions=1 -falign-jumps=1 -falign-loops=1 -fomit-frame-pointer
-D_GNU_SOURCE -DNDEBUG -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -c
-o /home/landley/busybox/busybox/coreutils/cat.o /home/landley/busybox/busybox/coreutils/cat.c
Appears to be switching it off.
Try adding this to the start of cat_main():
char cc;
cc=120;
cc+=100;
printf("test %d\n",cc);
When I run that, I get:
./busybox cat
test -36
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list