Do I need to #undef a local #define? Is there such a thing as a local define?

后端 未结 6 1064
刺人心
刺人心 2021-02-05 12:45

Sometimes to make things easier to write and read, I write some local #define macros within functions (for example, #define O_REAL Ogre::Real).

6条回答
  •  离开以前
    2021-02-05 13:22

    #define is handled by the preprocessor, which doesn't actually know C syntax at all. A #define ignores scope, and will remain in effect until you #undef it or until the end of the compilation unit.

提交回复
热议问题