Are unused includes harmful in C/C++?

后端 未结 10 583
说谎
说谎 2020-12-23 14:27

What are the negative consequences of unused includes?

I\'m aware they result in increased binary size (or do they?), anything else?

10条回答
  •  执念已碎
    2020-12-23 15:02

    • Increases compilation time (potentially serious issue)
    • Pollutes global namespace.
    • Potential clash of preprocessor names.
    • If unused headers are included from third-party libraries, it may make such libraries unnecessarily maintained as dependencies.

提交回复
热议问题