int32 et al. (was: Style guides and portability)

Richard Minner rtm at christmas.UUCP
Tue Jan 15 15:57:36 AEST 1991


I've gathered from this discussion (and others) that it is unlikely
that long will ever be implemented to be larger than int, unless int
is less than 32-bits (in a `quality' implementation?).  Is this so?
If it is, then just using long when you need at least 32 bits should
present no problems.  If it is not so, then using long could possibly
be `wasteful' (of space and time) if your code lived long enough to
be ported to, say, an environment with 32-bit ints and 64-bit longs.
As I said, I'm not too concerned, but could someone confirm my
suspicions?

Based on the above assumption about longs, I more or less go by the
following:

Requirements:                   Use:
 1 <= bits <=  8, save space    char
 9 <= bits <= 16, save space    short
 1 <= bits <= 16, save time     int
17 <= bits <= 32                long
and then maybe (not ANSI-C)
33 <= bits <= 64                long long?

Is that reasonable?

-- 
Richard Minner  rtm at island.COM  {uunet,sun,well}!island!rtm
Island Graphics Corporation  Sacramento, CA  (916) 736-1323



More information about the Comp.lang.c mailing list