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

David Brown
Wed Dec 11 01:26:00 GMT 2002

> The sense is to save bytes if my enum type is lower than 255 values; I
> for embedded systems with few kbytes of ram;
> > What does your HITACHI do, when accessing a data type, bigger than one
> > byte, on an even address (aligned(1)) ?
> When I'm sure my enum type is lower than 255 values, an unsigned char is
> enougth.
> > You dont expect a size of 4 for your enum - what's the sizeof(int) on
> > your machine ?
> my sizeof(int) in 4, but I'd like to give my enum sizeof(unsigned char),
> using gcc I can.
> Thanks.

Why not try the -fshort-enums compiler flag?  I have never used the Hitachi
processors, but I use gcc on the 68332 and the msp430.  There are some
compiler flags that I always use because they make sense on embedded
systems - -fshort-enums, -ffast-math, -funsigned-char, -funsigned-bitfields.

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

More information about the crossgcc mailing list