J
Jerry Coffin
[ ... ]
Yes, that's correct. I'll even generalize that a bit: in C89, NO
integer type can be larger than long.
Okay, I'll take your word for it.
Why not?
My interpretation was neither creative nor disingenuous. The latter
borders on a direct accusation, for which I think you owe an apology.
As it happens, my interpretation also matches that the C Committee
used in their response to Defect Report #067. They were asked
essentially the same question being considered here, but in more
detail:
--------------quote-------------------
The terms ``signed integer type,'' ``unsigned integer type,'' and
``integral type'' are defined in subclause 6.1.2.5. The C Standard
also uses the terms ``integer type,'' ``signed integral type,'' and
``unsigned integral type'' without defining them. Integer-valued
bitfields are also introduced in subclause 6.5.2.
[ ... ]
c. Can an implementation extension add other types defined by the C
Standard to any of these six categories?
d. Can an implementation define other types (e.g. __very long) which
belong to any of these six categories?
e. If the answer to (c) or (d), or both, is yes, can size_t and
ptrdiff_t be one of these other types, or must it be a type in the
above list?
[ ... ]
Response
[ ...]
c) No, the list in the C Standard is meant to be exhaustive. For
example, float cannot be defined as an integer type.
d) No strictly conforming program could contain an instance of such a
type. The treatment of such types is beyond the scope of the C
Standard.
e) No, it must be a type in the list. For example, size_t cannot be
defined as unsigned __int24.
--------------end of quote-------------
That _changed_ in C99 though: along with adding the requirement for
long long (in both signed and unsigned variants, of course) C99
defines the listed types as the "standard integer types". It then
adds a completely new possibility: implementation defined "extended
integer types" -- and says the "integer types" are the union of the
standard integer types and the extended integer types (along with
other irrelevant types like _Bool).
You're saying a C89 compiler can't have 32-bit 'long' and 64-bit
'size_t'.
Yes, that's correct. I'll even generalize that a bit: in C89, NO
integer type can be larger than long.
That would mean that there are /no/ conforming C89 compilers for 64-bit Windows,
where 'long' is 32 bits and 'size_t' is 64 bits.
Okay, I'll take your word for it.
I don't believe that.
Why not?
You quoted the C99 standard. Either your conclusion, which followed entirely
from a disingenious and fairly creative interpretation of that quote, does apply
to C99, or it doesn't, in which case it doesn't apply to C89 either. Choose.
My interpretation was neither creative nor disingenuous. The latter
borders on a direct accusation, for which I think you owe an apology.
As it happens, my interpretation also matches that the C Committee
used in their response to Defect Report #067. They were asked
essentially the same question being considered here, but in more
detail:
--------------quote-------------------
The terms ``signed integer type,'' ``unsigned integer type,'' and
``integral type'' are defined in subclause 6.1.2.5. The C Standard
also uses the terms ``integer type,'' ``signed integral type,'' and
``unsigned integral type'' without defining them. Integer-valued
bitfields are also introduced in subclause 6.5.2.
[ ... ]
c. Can an implementation extension add other types defined by the C
Standard to any of these six categories?
d. Can an implementation define other types (e.g. __very long) which
belong to any of these six categories?
e. If the answer to (c) or (d), or both, is yes, can size_t and
ptrdiff_t be one of these other types, or must it be a type in the
above list?
[ ... ]
Response
[ ...]
c) No, the list in the C Standard is meant to be exhaustive. For
example, float cannot be defined as an integer type.
d) No strictly conforming program could contain an instance of such a
type. The treatment of such types is beyond the scope of the C
Standard.
e) No, it must be a type in the list. For example, size_t cannot be
defined as unsigned __int24.
--------------end of quote-------------
That _changed_ in C99 though: along with adding the requirement for
long long (in both signed and unsigned variants, of course) C99
defines the listed types as the "standard integer types". It then
adds a completely new possibility: implementation defined "extended
integer types" -- and says the "integer types" are the union of the
standard integer types and the extended integer types (along with
other irrelevant types like _Bool).