One reason is that you can't do forward declarations of enums in
header files like you can do with structs. That means you have to
include header files in header files, which is generally avoided
whenever possible.
I don't think there's a good reason #defines are used instead of enums
to define the actual values, it's mostly out of habit / copying the
style of other files. There is no convention in the code style
guidelines at the moment:
http://wiki.blender.org/index.php/Dev:Doc/CodeStyle
On Sun, Jul 7, 2013 at 8:54 PM, David Jeske dav...@gmail.com wrote:
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?
___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers
___
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers