Does #include affect program size?

后端 未结 8 1030
一整个雨季
一整个雨季 2021-01-13 09:07

When my cpp file uses #include to add some header, does my final program\'s size gets bigger? Header aren\'t considered as compilation units, but the content of

8条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-13 09:40

    And you can also define global variables in header files (although I wouldn't recommend it). If you do, you should surround them with #ifdef/#end blocks so that they don't get defined in more than one compilation unit (or the linker would complain). In any case, this would increase the program's size.

提交回复
热议问题