This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> The sense is to save bytes if my enum type is lower than 255 values; I
develop
> 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),
and
> 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, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]