cocos2d namespace macros. Why?

Hi,

i wonder what’s the use of these macros:
* NS_CC_BEGIN
* NS_CC_END
* USING_NS_CC

They been giving me problems with static analysis tools (like Visual Studio C++ class designer).

Could they be deleted? I would do a pull request for it without any problem :stuck_out_tongue:

It’s easy to change namespace name if needed, for example. I don’t think that authors would remove this macros. In a big projects it’s a normal practice.

If they want to change the name of the namespace/framework they should only define the name as a macro (as its the only part that will/would change).
At least C++ won’t cease to accept namespaces tomorrow :stuck_out_tongue:

Another thing is, that I use the namespace name in my code (or any user code) so it’s not a good idea to change it. WIth the proposed macro i could use the macro instead of the name and no harm would be done for such change :slight_smile:

Examples:

namespace NS_CC { code here }

NS_CC::CCSprite* spritePointer;

using namespace NS_CC;

Static analysis tools would find that the namespace is called NS_CC instead of cocos2d, but that’s a minor problem, as long as they fail exactly the same way in the user’s code (assuming the user is using only the macro).

PS: and what’s the point on NS_CC_END? It’s only a “}”!