Why it's valid to include a header file twice in c++?

后端 未结 7 876
迷失自我
迷失自我 2021-02-09 17:25
#include \"DLLDefines.h\"
#include \"DLLDefines.h\"

The above actually passed compilation, but why?

7条回答
  •  死守一世寂寞
    2021-02-09 18:08

    As long as the multiple inclusion of header files do not violate ODR (One definition Rule) $3.2, the code is well-formed.

提交回复
热议问题