This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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]

Question on structure bit fields and portability?


I  found a  brief flicker  of a  discussion deriding  C  structure bit
fields as  not being  portable.  The reason  given was  basically that
structures can  be padded differently on  different architectures.  If
one uses  or expects the gcc  compiler across a  variety of platforms,
does that help alleviate the portability problem with bit fields?  Why
is it that compilers do  not automatically solve the bit field problem
consistently for  each given architecture?  Can someone  explain to me
the problem, or is there a better place for me to send this question?

Also, if bit  fields are a problem, what is  most eloquent solution to
solving  the   bit  reading  problem   in  terms  of   efficiency  and
readability?  Is there  a preferred and accepted method  to handle bit
fields?

Thanks,

marc

-- 


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