representation of struct field offsets

Mark Mitchell mark@codesourcery.com
Thu Sep 28 21:03:00 GMT 2006


Chris Lattner wrote:

> An alternative design, which would save a field, is just to keep the 
> offset of a field, in bits, from the start of the structure.

Yes, that would also work.  But, in many cases, you need the byte 
offset, so there's a time/space tradeoff.  Also, because of GCC's 
internal representation of integers, you have to be careful that you 
have enough bits; for example, you need 72 bits to represent things in a 
64-bit address space.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc mailing list