Cocos2d-X's code C++ correctness

Cocos2d-X's code C++ correctness
0.0 0



i’ve noticed that the framework contains some parts of code that are not following common recommendations from recognized C++ authors.
I’d like to discuss how/why are those parts of code like they are (maybe there’s a good reason for them!).

I don’t have a complete list but for now I remember this:
* Const correctness: for example CCNode::getTag() should be const, as it’s not modifing the object.
This const-correctness failures extends to user code that uses this methods.

  • Typedef-ed enums: all (or most of) the enums cocos2d-x has are declared like this:
    typedef enum _Name { Content } Name ;
    when they could simply be declared like this:
    enum Name { Content };



Also CCObject have public copy constructor.


you might probably want to do pull requests in order to change this


Added a pull request to add const: