enums

Hi, Can anyone help me with this :

enum bird { PIGEON, DOVE, HOX}; What is the runtime cost of this enum?
What do you mean runtime cost??

An Enum is just a named integer constant - They aren't any 'costs' that I can think of.
I came across it as an interview question. I didnt understand it so I was wondering if anyone else knew
I guess probably a doubleword array? Idk. Someone answer this!
If the data type needed is smaller than an int; this is a cost converting the int to an byte.
I do not use enum in embedded programing because #define does not require the conversion.
Note, I never really confirmed the above, just assumed it was true.

Tim S.




EDITED for profanity
Last edited on
Please don't be rude

I think what guestgulkan meant is that you wouldn't choose #define over enum unless it was necessary
Topic archived. No new replies allowed.