OT: Requesting C advice

Mike McCarty Mike.McCarty at sbcglobal.net
Thu May 24 10:04:18 UTC 2007


Andy Green wrote:
> Michael Hennebry wrote:
> 
> 
>>>printf("%d\n",-2);
>>>
>>>does not result in
>>>
>>>-2
>>
>>It should.
>>printf, declared or not, will look for an int and get it.
>>
>>printf("%u\n", -2);
>>is more interesting.
> 
> 
> That will do exactly the same on big and little-endian machines too, if
> the int size is the same.

Yes, of course. I gave a bad example. But, if one uses different sized
print formats from those in the int, it can do what I wrote...

printf("%d\n",(long int)-2);

can print

-1

for example, on a big-endian machine.

Mike
-- 
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
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!




More information about the fedora-list mailing list