Bug#442854: hex-a-hop: [m68k] FTBFS: packfile.h:57: error: size of array 'static_assert1' is negative

Jens Seidel jensseidel at users.sf.net
Wed Sep 19 07:54:03 UTC 2007


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





More information about the Pkg-games-devel mailing list