01-02-2008, 09:12 AM
Reggi Wrote:why i should write
unsigned int x_set:1
and not
uint32_t x_set:1? When uint32_t is a typedef unsigned int uint32_t; on a 32 bit architecture,
or
uint16_t x_set:1 When uint16_t is a typedef unsigned int uint16_t on a 16 bit architecture ??
What would the purpose of this be? The point of the "sized types" is that they offer some measure of platform portability. Here you are using them to decrease portability -- you'll need to ensure that your bit-field is declared with the type that matches int on your platform. If you want an unsigned bit field then "unsigned" is the word to use.
stephen