New Data Type?

USENET News news at awdprime.UUCP
Fri Mar 23 11:44:04 AEST 1990


In article <9918 at wpi.wpi.edu> oesterle at wpi.wpi.edu (Shawn H. Oesterle) writes:
>The following C data types have incremental sizes of 2^n bytes: 
>(unsigned) char, short, and long.  Some compilers have data type
Actually, it doesn't say anywhere that a short cannot be the same size
as a long, additionally a long could very well be 128 bits (or whatever
the size supported by the hardware is).

Quoting from K&R2 (2.2 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. ... Each complier 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.

>called 'long long' which is 64 bits long.  If 128 bit computers
true, some people have added 'long long'.

In cases where you wanted to maximize precision (and have portable
code) you would have to figure out the range (from standard headers or
by computation) of the data type and make your function smart enough to
use those values at run time.

-- sanders
For every message of the day, a new improved message will arise to overcome it.
Reply-To: cs.utexas.edu!ibmaus!auschs!sanders.austin.ibm.com!sanders     (ugh!)



More information about the Comp.lang.c mailing list