Compiler issue...

Maxim Kizub max at immsp.kiev.ua
Wed Jan 27 10:46:06 PST 1999


But this _does_ allocates 'data', which is at least double :-(
Isn't it better to have some kind of system-specific
macros that ensures correct align and goes to config.h,
for example

// for gcc
#define DOUBLE_ALIGN double align[0];
// for another one
#define DOUBLE_ALIGN \
 union { \
         double x; \
         whatever type y; \
 } align;

and put this in config.h ?

PS I really think that kaffe do not needs this align.
Object's fields offsets are to be calculated
based on it's type and system-depended align
for this type. Arrays of primitive types
may be processed on per-type base (by declaring
DoubleArray, IntegerArray, ShortArray structures
and so on).

Godmar Back wrote:
> 
>  I think Edouard's last patch removed the [0] arrays in favor of unions,
> like so:
> union {
>         double x;
>         whatever type y;
> } data;
> which achieve the same alignment.
> 
>         - Godmar
> 
> >
> > > Actually, I would suggest hiding the [0] arrays behind a macro called
> > > ALIGNMENT(), as this would hide the GNU-ism and make it easier to fix
> > > under other compilers (which might provide pragmas or somesuch for
> > > defining the alignment of a structure).
> >
> > Can you put a pragma inside a macro?  I didn't think you could put a
> > #include inside a macro.
> >
> > Jason
> >


More information about the kaffe mailing list