groff
[Top][All Lists]
Advanced

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

RE: [Groff] integer size


From: Ted Harding
Subject: RE: [Groff] integer size
Date: Mon, 29 Oct 2001 21:16:05 +0100 (GMT)

On 29-Oct-01 Bernd Warken wrote:
> With the GNU compilers, the sizes of the int family types are
> sufficient for the postprocessing.  But maybe, we cannot rely
>  on this, e.g. on embedded systems.
> 
> Both the unsigned int (65536 for colors) and the int type
> (72000 for ps resolution) need 32-bits integral types.  The GNU
> libraries provide this for standard (unsigned) int, but the ANSI
> C(++) have 16 bits by default and allow to provide even lower limits.
> 
> So it would be better to use the fixed length types int32_t and
> uint32_t provided by stdint.h .  This file is marked as being
>   `ISO C99: 7.18 Integer types <stdint.h>
> but I'm not sure if it is available everywhere.  glib provides similar
> types as well.
> 
> Maybe the safest way is to define abstract data types that are defined
> by preprocessor conditionals.

Probably the simplest work-round for this -- if it really is a
worry -- is a conditional define

  #if sizeof(int) < 32
  define int long int
  #endif

(Assuming of course that "long int" is long enough: long int is usually
at least 32 bits on standard C compilers.).

On the other hand, I'm not at all sure what C compilers we should
be worrying about here, if any. I certainly don't see much scope
for groff in embedded systems (or is there?).

Best wishes to all,
Ted.

On the other hand, I'm not sure 

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 29-Oct-01                                       Time: 21:16:05
------------------------------ XFMail ------------------------------

reply via email to

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