Description
The #pragma enum directive specifies the size of enum variables that follow. The size at the left brace of a declaration is the one that affects that declaration, regardless of whether further enum directives occur within the declaration. This pragma pushes a value on a stack each time it is used, with a reset option available to return to the previously pushed value.
Syntax
#pragma [options] enum ( (small | int | 1 | 2 | 4 | reset | pop) ) #pragma [options] enum = ( (small | int | 1 | 2 | 4 | reset | pop) )
where option can be substituted with one of the following:
Options | |
small | enum size is the smallest integral type that can contain all variables. |
int | enum size is 4 |
1 | enum size is 1 |
2 | enum size is 2 |
4 | enum size is 4 |
pop | the option will reset the enum size to the previously set enum size. |
reset | the option is an alternative method of resetting the enum size to the previous set enum size. This option is provided for backwards compatibility. |
Example:
#pragma enum(1) #pragma enum(2) #pragma enum(4) #pragma enum(pop) /* will reset enum size to 2 */ #pragma enum(reset) /* will reset enum size to 1 */