Limit scope of #define labels

后端 未结 9 848
被撕碎了的回忆
被撕碎了的回忆 2020-12-19 05:39

What is the correct strategy to limit the scope of #define labels and avoid unwarranted token collision?

In the following configuration:

9条回答
  •  轮回少年
    2020-12-19 06:33

    C is a structured programming language. It has its limitations. That is the very reason why object oriented systems came in 1st place. In C there seems to be no other way, then to understand what your header files's variables start with _VARIABLE notation, so that there are less chances of it getting over written.

    in header file 
    _ZERO 0
    
    in regular file
    
    ZERO 0
    

提交回复
热议问题