nanogui: Use of "unsigned long" for 32-bit quantities
Subject:
Re: Use of "unsigned long" for 32-bit quantities
From:
"Aaron J. Grier" ####@####.####
Date:
1 Jul 2005 21:20:17 +0100
Message-Id: <20050701201947.GK28754@mordor.unix.fryenet>
On Fri, Jul 01, 2005 at 10:25:54AM +0200, Alexander Stohr wrote:
> Alexander Neundorf wrote:
> > On Thursday 30 June 2005 21:44, Paul Bartholomew wrote:
> > ...
> > > I suggest a global header file with 'generic' typedefs (like
> > > "uint16", "uint32", etc), which can be customized based on your
> > > compiler. Then, instead of using types like "unsigned long" and
> > > "unsigned int" throughout the code (when the code really means:
> > > 32bits or 16 bits), use the new "uint32/uint16" types.
> >
> > Sounds good, IMHO this would be the right approach.
>
> GCC and many other compilers do support this:
>
> #include <stdbool.h>
> #include <stdint.h>
>
> bool x = true, y = false;
> uint8_t a;
> uint16_t b;
> uint32_t c;
> uint64_t d;
> int8_t e;
> int16_t f;
> int32_t g;
> int64_t h;
I believe these are part of C99 standard:
http://www.opengroup.org/onlinepubs/009695399/basedefs/stdint.h.html
http://www.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html
use 'em when # of bits is meaningful.
--
Aaron J. Grier | Frye Electronics, Tigard, OR | ####@####.####