sizeof (integral types)

Guy Harris guy at auspex.auspex.com
Wed Apr 19 17:19:09 AEST 1989


>Considering that C++ is an *EXTENSION* of C (and was written with K&R as
>active participants), the fact that C++ talks about longs as at least 24 bits
>is true for C as well.

Assuming that every statement made about C++ of that sort must *ipso
facto* apply to C, I guess that's true, since the pANS says that longs
must hold values in a range that, in binary, requires 32 bits, and 24 is
greater than 32....  However, K&R I makes no statement about "long"s,
and the pANS quite clearly says, for binary implementations, "32 bits",
not "24 bits".

However, the fact that C++ talks about the "class" keyword doesn't make
it a C keyword - since C++ is an extension of C, there are a lot of
things C++ talks about that *aren't* true of C.  As such, the assumption
in paragraph 1) isn't true, so C++ isn't all that relevant in this
particular case anyway.

On top of that, the C++ Reference Manual appendix of the first edition
of S (is there a second edition?) sayeth nothing about the minimum size
of a "long", and the section that *does* say somthing merely says that
"it is usually reasonable to assume" that a "long" has at least 24 bits,
and right after it says quite explicitly that "even this rule of thumb
does not apply universally."

In short, the statement in the C++ book has nothing authoritative to say
whatsoever about the sizes of "long"s in C - and it doesn't even seem to
have anything authoritative to say about the sizes of "long"s in C++!



More information about the Comp.lang.c mailing list