Re: OT: Requesting C advice

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

 



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@xxxxxxxxxxxxxxxxxxxxx
"Horse guts never lie."  -- Cherek Bear-Shoulders


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux