draft ANSI standard: one change that would *really* help Europe

braner braner at batcomputer.tn.cornell.edu
Fri Dec 5 16:12:58 AEST 1986


[]

One way to use the European chars, while leaving 'char' signed, is
to explicitly declare char variables 'unsigned' in European programs.
Since there is no 8-bit standard just yet, would this requirements
break many existing programs?

As for the use of chars for very short signed integers: seems to me
like a bad practice.  That's what 'short' is for.  Perhaps another,
smaller type ('tiny') would be useful, as has been suggested.

I object, though, to the complaints you hear from some people when a
given compiler breaks their code by using an unexpected size for, say,
'int's.  K&R say explicitly that no sizes are guaranteed, and that their
intention was that 'short' would be shorter than 'long', and 'int'
would be the "most natural word size for the machine".  On the 68000, say,
that pretty much translates to 8, 16 and 32 bits for short, int and long.

I suggest that the standard require:

	'short' to be at least 8 bits,

	'int' to be at least 16 bits (but 32 bits NOT promised!),

	'long' to be at least 32 bits and long enough to hold a pointer.

These requirements, being MINIMUM sizes, would only guarantee that a
program which assumes them would work everywhere.  But note: the
assumption that (unsigned shorts) 0200 + 0200 == 0 is NOT legal,
since it assumes the size is NO MORE than 8 bits!

- Moshe Braner



More information about the Comp.lang.c mailing list