Re: OT: Requesting C advice

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


Michael Hennebry wrote:
On Wed, 23 May 2007, Mike McCarty wrote:

Michael Hennebry wrote:

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?
On big-endian machines, they can. For example, with two's complement
arithmetic on a big-endian machine,


does not result in


It should.
printf, declared or not, will look for an int and get it.

printf("%u\n", -2);
is more interesting.
We might be in the domain of nasal demons.
printf("%u\n", (unsigned)-2);
Is legal, but rather obviously will not print "-2\n".
It will probably print something even regardless of endianness.
No, I gave an incorrect example, sorry.

long int	Li;

Li = -2;


on a 16 bit two's complement big endian machine may result in


Oppose globalization and One World Governments like the UN.
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!

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

  Powered by Linux