On Wed, Sep 19, 2007 at 09:03:18AM +0200, Geert Uytterhoeven wrote:
> On Wed, 19 Sep 2007, Jens Seidel wrote:
> > Nevertheless I'm nearly sure that this platform doesn't align a char[1]
> > array on 64 bit boundaries so the code should work :-)
> 
> > typedef struct Entry {
> >   int32_t len;
> >   // could there be an alignment gap here?
> >   char name[1];
> > } Entry;
> 
> On m68k, 32-bit quantities must be aligned to 2 bytes.
> Since sizeof() of a struct always gives a value that's a multiple of the
> maximum alignment of the individual fields of the struct, you get 6 (5
> rounded up to a multiple of 2).

Thanks, I assumed this after getting the error.

A not m68k related question:

Is it OK to interpret a random char pointer as Entry* or need this data
be on an even adress? Will do following work (is used by the program this
way!):

char tmp[10];

Entry *e0 = (Entry*)&tmp[0];
Entry *e1 = (Entry*)&tmp[1];

Either &tmp[0] or &tmp[1] is not an even address.

Thanks,
Jens



_______________________________________________
Pkg-games-devel mailing list
Pkg-games-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-games-devel

Reply via email to