I am making an updated version of an application that uses bit fields.  For instance, 
there are variables of type
unsigned int max : 10
unsigned int rng : 3
unsigned int sec : 8

These values will be written to a binary file, which must be able to be read in by 
another existing application.  So, for instance, there must only be 3 bits written to 
file for variable 'Rng', or the other application won't read the data in correctly.  
This can't be changed.

First, should I change the values which are of size 8 bits to small ints, and forget 
using bit fields for those?  Can I depend on a small int to be 8 bits, 20 years from 
now?

Second, what is the best way of dealing with the other variables which are bit fields 
(different than 8 bits), in cases such as assignment? Should I make a typedef for each 
different bit size, then use a static_cast?

Jean Palmer
> * [EMAIL PROTECTED]
> 
> 


Reply via email to