OT: Requesting C advice

Michael Hennebry hennebry at web.cs.ndsu.nodak.edu
Wed May 23 19:49:35 UTC 2007


On Wed, 23 May 2007, George Arseneault wrote:

> Now the bad news... C, C++, gnu, several variations on
> the ISO; not to mention all the libraries, etc.  And,
> to top it off, some of the stuff in the book just
> doesn't work.  (A program to demonstrate the various
> types of integer variables and how to display them
> with printf(), failed to show any difference with any
> arguments I could find.)

Should they have produced different results?
Printing (int)sizeof(typename) will distinguish some types.
Note that short, int and long usually only have two distinct sizes.
It's allowed, but rare, for all the arithmetic types to have size 1.

The following will distinguish signed and unsigned:
unsigned u=-1, v=1;
int      i=-1, j=1;

(u> v) != (i> j)


This question might get better advice
if posted in a newsgroup devoted to C.

-- 
Mike   hennebry at web.cs.ndsu.NoDak.edu
"Horse guts never lie."  -- Cherek Bear-Shoulders




More information about the users mailing list