QUESTION: strange behaviour of typedef enum and __attribute__((packed)) using sh-hms-g++ 3.0.3

Fabio Giovagnini
Wed Dec 11 07:08:00 GMT 2002

if I write:
typedef enum en {em_f1 = 0, em_f2, em_f3}__attribute__((packed)) em_t;

I obtain a sintzx error;
if I write:
typedef enum en {em_f1 = 0, em_f2, em_f3}em_t __attribute__((packed)) ;

everything works fine at compile time but the sizeof is not packed neither 

The same happens with __attribute__((packed),aligned(1)))

I solved the proble using -fshort-enums in CXXFLAGS and CFLAGS.


Alle 15:25, mercoledì 11 dicembre 2002, William A. Gatliff ha scritto:
> Fabio:
> > If I define
> > typedef enum en {em_f1 = 0, em_f2, em_f3} em_t
> > __attribute__(((packed),aligned(1)));
> What happens if you leave the aligned(1) off?
> b.g.

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list