Macro that accept new object
问题 In my code, I have: #define EV( event ) SendEvent( new event ); EV( evFormat ); But I want to pass a created object in the EV macro, like: CEvent *ev = new CEvent(); EV( ev ); Is this possible? Because there is no way I will modify the EV macro. 回答1: #define EV( event ) SendEvent( new event ); // Can't be changed. The macro enforces that each call to SendEvent should create a new dynamic object. Your problem is not just that using a macro for that is stupid and e.g. reduces the readability of