Does #include cost anything?

Apr 20, 2014 at 7:17am
If I #include a header but use NOTHING from/in it, will the program slow down a lil' bit or will the size of the program file enlarge?
Apr 20, 2014 at 7:27am
Best to just not include it in the first place if you do not require it. And it depends on what the header contains but you can expect a bigger file. If a dynamic link library is included it will slow down the program.
Last edited on Apr 20, 2014 at 7:31am
Apr 20, 2014 at 7:33am
But if I just want to use a very simple function in the header, as I said will the program slow down or the file size enlarge?
Apr 20, 2014 at 7:43am
But if I just want to use a very simple function in the header


Well both really because regardless function you are trying to include it is going to perform some type of calculation or process (or you wouldn't be using it in the first place).
Last edited on Apr 20, 2014 at 7:49am
Apr 20, 2014 at 7:53am
I wouldn't worry about that at this stage, processors are really fast. When you have a huge program and you want to trim the fat. that is when you can start to worry about it.
Last edited on Apr 20, 2014 at 7:54am
Apr 20, 2014 at 7:55am
#including a header will not slow down your program or enlarge it.

It will, however, increase the compilation time as there is more code in the form of declarations/definitions to process. There may also be some additional time spent in the preprocessing phase of the compilation process.
Apr 20, 2014 at 9:02am
OK. Thanks
Topic archived. No new replies allowed.