Path: utzoo!attcan!uunet!mailrus!ncar!groucho!steve From: steve@groucho.ucar.edu (Steve Emmerson) Newsgroups: comp.lang.c Subject: Re: IsUnsigned() function? Message-ID: <8118@ncar.ucar.edu> Date: 28 Jul 90 23:23:02 GMT References: <1990Jul27.161339.14712@kfw.COM> Sender: news@ncar.ucar.edu Organization: University Corporation for Atmospheric Research (UCAR) Lines: 12 In <1990Jul27.161339.14712@kfw.COM> will@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@unidata.ucar.edu ...!ncar!unidata!steve