Simple yet effective game engine architecture patterns?

Started by
21 comments, last by Juliean 2 years, 3 months ago

One big problem with macros is they do not respect scopes, e.g. of a namespace. It's thus likely to get collisions of multiple macros with the same names in larger project.

Advertisement

Aside from macros being unscoped (which I agree), you also cannot effectively debug code that is generated by macros. So I personally mostly use macros to do things the doesn't generate any code, but mostly declarations, for example:

class AE_API EntityManager
{
public:
	EntityManager(void);
	NON_COPYABLE(EntityManager);
};

I personally don't see any benefit in typing what this macro does out (I'm confident everybody should get what its doing).

But the bigger benefit from the enum-library posted (which I didn't know about and find pretty cool) is simply: You can just call the functions, and don't have to deal with any kind of declaration/registration at all. No matter if written by hand or by macro, registering the enum-values is a pain that I'd like to avoid. So if a library can do that, thats pretty great. It seems that this library inspects the demangled name of a template-function to find out the enum-values, which didn't even come to my mind.

This topic is closed to new replies.

Advertisement