Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Casting ctype lookups

On Thu, Nov 15, 2012 at 06:32:15AM -0500, D'Arcy J.M. Cain wrote:
> > 
> > If your code is in EBCDIC (not ASCII) then "Test string" is (I think):
> > { 0xe3, 0x85, 0xa2, 0xa3, 0x40, 0xa2, 0xa3, 0x99, 0x89, 0x95, 0x87,
> > 0 } and you keep passing invalid values to toupper() - with undefined
> > results (which is allowed to include 'format the hard drive').
> OK...
> $ gcc -funsigned-char -Wall -Werror -o t t.c && ./t
> Does the same thing.  The function version still works.  It may be that
> gcc is the problem, at least in this case, but gcc is what we provide.

No you still don't seem to have grasped the fact that just because
your program happens to produce the output you expect that the
program is working.

If gcc generates that warning for any of the ctype functions (as
macros) then the calling code is almost certainly incorrect.


David Laight:

Home | Main Index | Thread Index | Old Index