groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] integer size


From: Ralph Corderoy
Subject: Re: [Groff] integer size
Date: Tue, 30 Oct 2001 08:33:12 +0000

Hi Bernd,

> long int is not garanteed to be >=32 bits by the ANSI standards.

The C Programming FAQ says use long if you want more than 16-bits.

    http://www.eskimo.com/~scs/C-faq/q1.1.html

And section B11 of K&R2 gives the minimum magnitudes of <limits.h>,
inc.

    INT_MAX         +32767
    INT_MIN         -32767
    LONG_MAX   +2147483647L
    LONG_MIN   -2147483647L

If we're ANSI C then long is at least 32 bits.

> Maybe a new type must be created that is tuned by #ifdef's on the
> size.

BTW, you can't use sizeof in a preprocessor's constant expression, e.g.
`#if sizeof(int) < 4' is illegal under ANSI C.  Sorry Ted, I've been
there and done that before but didn't remember straight away.  The
normal solution is for the configure script to test and define
appropriate macros.

Cheers,


Ralph.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]