This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reading and writing GSL random number generators


On Wed, 28 May 2003, Olaf Lenz wrote:

> What type is best to use when you really need one byte (i.e. 8 bit)?

In C99 (ISO 9899:1999) you can #include <stdint.h> and use int8_t
(signed) or uint8_t (unsigned), which, if they exist, are exactly 8
bits wide;  int_least8_t is required to exist and is at least 8 bits
wide.  However, this may not be a good move at this point, as C99
isn't widely supported yet.

> Is and will char always be 8 bit?

Doesn't look like it.  Quoting the C99 standard:  "An object declared
as type char is large enough to store any member of the basic
execution character set." (6.2.5)  And: "The representation of each
member of the [...] execution basic character [set] shall fit in a
byte." (5.2.1)  So char would have to be at least 8 bits wide, but
could be wider.

- martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]