How soon can `sizeof (tagged_type)' be used?
Erik Naggum
enag at ifi.uio.no
Tue May 21 02:45:56 AEST 1991
Erik Naggum writes:
|
| What is "sizeof (enum E)" supposed to return if not the same as
| "sizeof (int)"?
Norman Diamond writes:
|
| sizeof (short), sizeof (long), or sizeof (other_integral_type_which_the_\
| implementation_is_allowed_to_define_even_though_portable_programs_cannot_\
| directly_name_this_type)
Right. There's a subtle difference between the type of enumerators
and the enumeration type itself. Section 3.5.2.2 of dpANS of 1/11/88
(sorry, I have the proper standard at my office) specifies that the
former have type int, while the enumerated type "shall be compatible
with an integer type; the choice of type is implementation-defined".
(Why this is so escapes me.)
</Erik>
--
Erik Naggum Professional Programmer +47-2-836-863
Naggum Software Electronic Text <enag at ifi.uio.no>
0118 OSLO, NORWAY Computer Communications <erik at naggum.uu.no>
More information about the Comp.std.c
mailing list