Post

Replies

Boosts

Views

Activity

Code optimization issue Xcode 7
Hi,I have run into a new problem that started happening once I moved from Xcode 6 to Xcode 7.I am using a framework called Cocos2d-x using C++.I am getting strange results when compiling with any code optimization above -C0.I use a macro called CC_SYNTHESIZE to simply create getters/setters for a variable.The macro is defined like this:#define CC_SYNTHESIZE(varType, varName, funName)\ protected: varType varName;\ public: virtual varType get##funName(void) const { return varName; }\ public: virtual void set##funName(varType var){ varName = var; }Here is an example of usage:CC_SYNTHESIZE(bool, gravityFlipped_, GravityFlipped);Without code optimization this works as intended, but with code optimization enabled this variable and others act erratically and does not change when the set function is called.If I replace the macro and instead write the code manually it works with code optimization enabled.protected: bool gravityFlipped_; public: virtual float getGravityFlipped(void) const { return gravityFlipped_; } public: virtual void setGravityFlipped(float val) { gravityFlipped_ = val; }Any idea what the underlying problem could be or any steps for troubleshooting?Thanks,Rob
2
0
3.3k
Jul ’16