#define vs enum in an embedded environment (How do they compile?)

Posted by Alexander Kondratskiy on Stack Overflow See other posts from Stack Overflow or by Alexander Kondratskiy
Published on 2011-01-09T06:31:58Z Indexed on 2011/01/09 6:53 UTC
Read the original article Hit count: 231

Filed under:
|
|
|

This question has been done to death, and I would agree that enums are the way to go. However, I am curious as to how enums compile in the final code- #defines are just string replacements, but do enums add anything to the compiled binary? Or are they both equivalent at that stage. When writing firmware and memory is very limited, is there any advantage, no matter how small, to using #defines?

Thanks!

EDIT: As requested by the comment below, by embedded, I mean a digital camera.

Thanks for the answers! I am all for enums!

© Stack Overflow or respective owner

Related posts about c

    Related posts about enums