#define vs enum in an embedded environment (How do they compile?)
- by Alexander Kondratskiy
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!