Are unused includes harmful in C/C++?

后端 未结 10 580
说谎
说谎 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:13

    Yes, they can increase binary size because of extern unused variables.

    //---- in unused includes ----
    extern int /* or a big class */ unused_var;
    
    //---- in third party library ----
    int unused_var = 13;
    

提交回复
热议问题