Why aren't my include guards preventing recursive inclusion and multiple symbol definitions?

前端 未结 3 1274
野趣味
野趣味 2020-11-22 05:35

Two common questions about include guards:

  1. FIRST QUESTION:

    Why aren\'t include guards protecting my header files from mutua

3条回答
  •  心在旅途
    2020-11-22 06:12

    fiorentinoing's answer is echoed in Git 2.24 (Q4 2019), where a similar code cleanup is taking place in the Git codebase.

    See commit 2fe4439 (03 Oct 2019) by René Scharfe (rscharfe).
    (Merged by Junio C Hamano -- gitster -- in commit a4c5d9f, 11 Oct 2019)

    treewide: remove duplicate #include directives

    Found with:

    git grep '^#include ' '*.c' | sort | uniq -d
    

提交回复
热议问题