derived types

Norman Diamond ndiamond at watdaisy.UUCP
Wed Jan 23 07:10:37 AEST 1985


> what we really want is to define c, as knuth did with mix, to say that
> char has a minimum holding value of 2^8-1 and short 2^16-1 and long
> 2^32-1 with int being bound to either short or long.  this eliminates
> the implementation problems on all machines because all you do is
> select the smallest element that will hold the specified type.
> 
>                           shades at mit-oz.arpa

Except that we'd have to say something like 2^6-1 and 2^12-1.
This is a case where even I would not try to make every program as
portable as it could be.  If there were some reason to assume that
chars could hold 2^8-1, I would assume it (and include a warning).
But if the standard specifies this, it would leave some machines
with an option of (i) non-conforming implementations, (ii) no
implementations, or (iii) wasted space and inefficient code just
to meet this requirement.  And if the standard specifies 2^6-1,
then many people (including me) would be discouraged from writing
standard-conforming programs.

I try to make Pascal programs portable too (standard-conforming
and with a certain amount of care, with exceptions carefully
encapsulated).  But if I need "set of char", I do it and warn
that it might not be portable for that reason.

-- Norman Diamond

UUCP:  {decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdaisy!ndiamond
CSNET: ndiamond%watdaisy at waterloo.csnet
ARPA:  ndiamond%watdaisy%waterloo.csnet at csnet-relay.arpa

"Opinions are those of the keyboard, and do not reflect on me or higher-ups."



More information about the Comp.lang.c mailing list