IsUnsigned() function?

Steve Emmerson steve at groucho.ucar.edu
Sun Jul 29 09:23:02 AEST 1990


In <1990Jul27.161339.14712 at kfw.COM> will at kfw.COM (Will Crowder) writes:

>What's wrong with:

>#define IsUnsigned(type)	((type)0 - 1 > 0)

Unless I'm mistaken, in ANSI C "(char)0" will, on most machines,
promote to "signed int" due to the value-preserving rule; consequently,
the above expression will always be false on those machines, regardless
of the signedness of "char".

Steve Emmerson        steve at unidata.ucar.edu        ...!ncar!unidata!steve



More information about the Comp.lang.c mailing list