Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/11/12 09:26
Read: times


 
#188306 - no defined bit order
Responding to: ???'s previous message
Per Westermark said:
Next thing - you show sample code with union + C bit fields. But note that bit fields is a C construct to store multiple small state information fields more compactly into a larger integer. The C language do not have bit variables, and the bit field construct is intended to make the C source code look like it accesses normal struct member fields while the compiler performs logical and/or/not operations to set/clear bits within the containing byte.
[...]
The C bit fields are always stored side-by-side (with optional high or low padding) in a container integer of an appropriate size.

True, but also note:

C-standard said:
The order of allocation of bit-fields within a unit (high-order to low-order or low-order to high-order) is implementation-defined.

This means that the compiler gets to choose which order it uses (globally, not case-by-case) and another compiler can make a different choice.

List of 11 messages in thread
TopicAuthorDate
Different variable bit merge into single variable?            01/01/70 00:00      
   Of course            01/01/70 00:00      
      its bit addressable....            01/01/70 00:00      
         No            01/01/70 00:00      
            just want to check...            01/01/70 00:00      
               What was missing in the answers you have already received?            01/01/70 00:00      
                  no defined bit order            01/01/70 00:00      
                     Just use C expression            01/01/70 00:00      
         what is wrong with IE?            01/01/70 00:00      
            Right!!!!!!!!!!            01/01/70 00:00      
               gobbledygook            01/01/70 00:00      

Back to Subject List