[Bf-committers] int vs enum use?

David Jeske davidj at gmail.com
Sun Jul 7 20:54:20 CEST 2013


Is there any particular reason (besides legacy) that many parts of the code
still use int/#define, instead of using enums?

Even though C-compilers don't typecheck enums, there is a documentation /
readability benefit to using enums. Using enum-forward declaration avoids
any header nastiness.

For example ...

void BKE_nurbList_handles_set(struct ListBase *editnurb, int mode);

void BKE_nurbList_handles_set(struct ListBase *editnurb, enum
eHandleSetModes mode);

The latter is much easier to understand and investigate.

I'd personally like to make patches which simply add the proper enum types
to help document things for myself and others. Any reason not to do this?


More information about the Bf-committers mailing list