svn commit: trunk/uClibc: include
Denys Vlasenko
vda.linux at googlemail.com
Mon Jan 12 08:47:40 UTC 2009
On Thursday 08 January 2009 08:35, Rob Landley wrote:
> > But -funsigned-char is much more safe than signed one.
> > Point me to a bug (in any program not just uclibc)
> > which happens with unsigned chars but works with signed ones.
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main(int argc, char *argv[])
> {
> for(;;) {
> unsigned char c = fgetc(stdin);
> if (c == EOF) {
> printf("Walrus\n");
> exit(0);
> }
> putchar(c);
> }
> }
>
> Remove the "unsigned" and it works fine.
>
> Not saying it's good code,
:) it thinks that '\xff' is EOF :)
> but you asked for a behavior change that happens
> out in the wild.
Yeah, it's trivial to construct a program which
wants char to be signed.
--
vda
More information about the uClibc
mailing list