[comp.binaries.ibm.pc.d] C ints

bobmon@iuvax.cs.indiana.edu (RAMontante) (02/21/90)

CMH117@psuvm.psu.edu (Charles Hannum) <90052.022126CMH117@psuvm.psu.edu> :
-
-K&R2 [ANSI-standard] C specifies:
-
-   "int" (neither far nor short) implicitly means "short int"
-
-   "short int"s are 16 bits
-
-Your compiler is broken.


Where do you get that "int" means "short int"???  To quote K&R2 p.36,
"Data Types and Sizes":

  The intent is that _short_ and _long_ should provide different lengths of
integers where practical; _int_ will normally be the natural size for a
particular machine.  _short_ is often 16 bits, _long_ 32 bits, and _int_
either 16 or 32 bits.  Each compiler is free to choose appropriate sizes
for its own hardware, subject only to the restriction that _shorts_ and
_ints_ are at least 16 bits, _longs_ are at least 32 bits, and _short_ is
no longer than _int_, which is no longer than _long_.

Shorts and ints are allowed to be the same size, but they needn't be; ints
and longs can also be the same size.

Also, on p.211 ("Type Specifiers"):

  At most one of the words _long_ or _short_ may be specified together
with _int_; the meaning is the same if _int_ is not mentioned.  [The
converse of the above assertion-bobmon]  The word _long_ may be specified
together with _double_.  At most one of _signed_ or _unsigned_ may be
specified together with _int_ or any of its _short_ or _long_ varieties,
or with _char_.  Either may appear alone, in which case _int_ is understood.
The _signed_ specifier is useful for forcing _char_ objects to carry a
sign; it is permissible but redundant with other integral types.
  Otherwise, at most one type-specifier may be given in a declaration.  If
the type-specifier is missing from a declaration, it is taken to be _int_.