Non-Portable pointer assignment?

Tim McDaniel mcdaniel at adi.com
Fri Jun 7 23:54:13 AEST 1991


In article <1991Jun7.013605.728 at tkou02.enet.dec.com> diamond at jit533.swstokyo.dec.com (Norman Diamond) writes:

   The answer is very ugly.  Some old programs took advantage of being able
   to put more than one char in a char constant, since it was really an int.

I would have been quite content to have seen the types and sizes of
'xy' and 'x' differ.  (The 'xy' implementation-defined semantics could
have been tighted a bit, too.  If sizeof (T) is N, then other parts of
the C standard require that N characters fit into T.  Some wording
could have been found to require that multiple-byte character
constants have up to N characters placed in distinct bytes.  Or maybe
they just should have been forbidden -- they're fairly useless
anyway.)

   Actually [enum constants are int] is one of the few consistent
   things around.  For example, 3 is not a char even though it fits in
   one, and 3 is not a short even though it fits in one.

I've never declared 3 to be a value of a type.  Enumeration constants,
however, *are* declared to be within a particular enumeration type.

--
   "Of course he has a knife; he always has a knife.  We all have knives.
   It's 1183 and we're barbarians."
Tim McDaniel                 Applied Dynamics Int'l.; Ann Arbor, Michigan, USA
Internet: mcdaniel at adi.com                UUCP: {uunet,sharkey}!amara!mcdaniel



More information about the Comp.std.c mailing list