How big is an enum?
I noticed something odd while browsing through the assembly output of some AVR C code I wrote recently. In the code, I have the following expression:
int main() {
setup();
while (state != STATE_QUIT) {
loop();
}
}
Here, state
is a variable of type enum STATE
, which looks something like this (not exactly like this; there are actually 19 possible values but I didn’t want to clutter this post with unnecessary code listings):