Style guides and portability

Rahul Dhesi dhesi%cirrusl at oliveb.ATC.olivetti.com
Fri Jan 18 15:46:52 AEST 1991


In <1163 at tredysvr.Tredydev.Unisys.COM>
paul at tredysvr.Tredydev.Unisys.COM (Paul Siu) writes:

     While looking through Thomas Plum's style guide, I notice he
     mentions that one should set up a separate #define file for data
     types.

It's a good idea.  In the future I am planning to use defines or
typedefs similar to the following.

     name               property
     ----               --------
     t_int8              8 bits or more, signed
     t_xint8             8 bits or more, signed or unsigned
     t_uint8             8 bits or more, unsigned
     t_int16            16 bits or more, signed
     t_xint16           16 bits or more, signed or unsigned
     t_uint16           16 bits or more, unsigned

The idea behind having a "signed or unsigned" data type is that when
you don't care (e.g. when storing bits or smallish unsigned values),
you can use whichever type (signed or unsigned) is handled more
efficiently on a given machine.
--
Rahul Dhesi <dhesi%cirrusl at oliveb.ATC.olivetti.com>
UUCP:  oliveb!cirrusl!dhesi



More information about the Comp.lang.c mailing list