[Flac-dev] 64-bit FLAC structure sizes and padding
Erik de Castro Lopo
mle+la at mega-nerd.com
Mon May 30 04:35:16 PDT 2011
Jerker Bäck wrote:
> > Err, no it wouldn't. In fact this example you gave only confuses
> > the matter.
>
> ? What do you mean?
Because the struct has entry as a pointer, not as an array.
> typedef struct {
> FLAC__uint32 length;
> FLAC__byte *entry;
> } FLAC__StreamMetadata_VorbisComment_Entry;
>
> Can you confirm that the entry member is a pointer and not a byte array?
Yes, its a pointer, the C type says so.
> In that case:
> What happens if the compiler expands the size of the structure twice (8=>16
> bytes)?
On a 32 bit system the 'entry' pointer will be 4 bytes and be located
4 bytes from the start of the struct.
On a 64 bit system, the 'entry' pointer will be 8 bytes and be located
8 bytes from the start of the struct (with 4 bytes of padding between
the 'length' field and the 'entry' field).
So, comparing the struct on a 32 vs a 64 bit system, the structures have
different sizes and the 'entry' pointers have different offsets from the
start of the struct, but so what? Why do you think that is a problem?
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
More information about the Flac-dev
mailing list