> Err, no it wouldn't. In fact this example you gave only confuses > the matter.? What do you mean? 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? In that case: What happens if the compiler expands the size of the structure twice (8=>16 bytes)? I did some debugging to examine the structure sizes but I'm not quite sure.
Ivailo Karamanolev
2011-May-30 11:29 UTC
[Flac-dev] 64-bit FLAC structure sizes and padding
What other people explained earlier, there is no difference whatsoever what is the size of the structure regarding the file format. The library reads the file independent of the structures you are mentioning and fills the data in them just in order to present them to the library user (you). It doesn't depend on the structure size in order to read the file format correctly. On Mon, May 30, 2011 at 2:25 PM, Jerker B?ck <jerker.back at gmail.com> wrote:> > Err, no it wouldn't. In fact this example you gave only confuses > > the matter. > > ? What do you mean? > > 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? > > In that case: > What happens if the compiler expands the size of the structure twice (8=>16 > bytes)? > > I did some debugging to examine the structure sizes but I'm not quite sure. > > > _______________________________________________ > Flac-dev mailing list > Flac-dev at xiph.org > http://lists.xiph.org/mailman/listinfo/flac-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20110530/205b7379/attachment.htm
Erik de Castro Lopo
2011-May-30 11:35 UTC
[Flac-dev] 64-bit FLAC structure sizes and padding
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/