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

后端 未结 6 1071
刺人心
刺人心 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条回答
  •  猫巷女王i
    2021-02-05 13:15

    No. There are no such things as "local" #defines.

    The scope in which the #define is placed, is unknown at the time as they are processed by the - well - preprocessor. (Hence you sometimes hear the term "preprocessor directive" instead of just "macro".)

提交回复
热议问题