OT: Requesting C advice

Mike McCarty Mike.McCarty at sbcglobal.net
Wed May 30 20:20:22 UTC 2007


Les Mikesell wrote:
> Mike McCarty wrote:
> 
>>
>> Those interested in historical matters might look here:
>> http://cm.bell-labs.com/cm/cs/who/dmr/chist.html
> 
> 
> OK but...
> 
>>> Actually, that was a huge bone of contention in the committee meetings.
>>> The 16-bit integer was the "native" size of the registers on the machine
>>> that C was developed on (the PDP-11), so it sorta stuck.  However, the
>>> standard makes absolutely no guarantees on how big an "int" is.   It is
>>> completely up to the implementer of the compiler as to how big an "int"
>>> is (or a "char" is or an "unsigned long long" is...that's why the
>>> "sizeof" operator exists).
>>
>>
>> This is incorrect. An integer must be able to represent at least
>> numbers in the range -32767 to 32767 inclusive.
> 
>  >
> 
>> [QUOTE MODE ON]
>>
>> 5.2.4.2.1  Sizes of integer types <limits.h>
> 
> 
> A quote from a 1989 standard?  What were integers between 1973 and 1989? 
>    The language was well established before any committee meetings.

A quote from a 1999 standard, actually. I was responding to the
words above "However, THE STANDARD [emphasis added] makes absolutely no
guarantees on how big an 'int' is. It is completely up to the
implementer of the compiler as to how big an 'int' is (or a 'char' is
or an 'unsigned long long' is...that's why the 'sizeof' operator
exists)."

Note the present tense used. This claim is incorrect. The Standard
makes very definite statements about the sizes of integral types, in
terms of what they are guaranteed to be able to represent.

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