So.. my understanding of enums is that they are char's by default.. i was wondering, plain and simple, whether you can use integers instead of chars in the enum and obviously.. how i would do it..
Cheers
Chris
Cheers
Chris
In C32, an integer type, be it an int, signed int, unsigned int, long, signed long, unsigned long, are all 32 bits long.MPLAB® C Compiler for PIC32 MCUs Users Guide said:ISO Standard: The integer type compatible with each enumerated type (C90
6.5.2.2, C99 6.7.2.2).
Implementation: If the enumeration values are all non-negative, the type is
unsigned int, else it is int. The -fshort-enums command line option can change this.
Options for Code Generation Conventions said:-fshort-enums:
Allocate to an enum type only as many bytes as it needs for the declared range of possible values. Specifically, the enum type is equivalent to the smallest integer type which has enough room.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
Typedef in C | Programming & Languages | 32 | ||
Oshonsoft 64 bit integers | Microcontrollers | 2 | ||
E | f_write for integers or wchar_t on stm32 | Microcontrollers | 1 | |
O | Designing a demux for even odd integers | Digital Design | 3 | |
D | Typedef enum not seen by all .c files? How to creat macro | Programming & Languages | 2 |