/
How can we make our code compile fast?

How can we make our code compile fast?

Let’s say we have a function which takes a string as an argument. Our string class is called COLstring. Best practice is to predeclare the COLstring class in the header file so that we can avoid including the COLstring.h header file like this:

class COLstring; // This is better than using #include <COL/COLstring.h> void FILload(const COLstring& Name, COLstring* pData);

In this case it doesn’t make much difference in compilation speed but it adds up through the network effect:

I say the same thing in other language here.

Related content

C Preprocessor
C Preprocessor
More like this
Why do we need header files?
Why do we need header files?
More like this
How do you see how the pre-processor processes code?
How do you see how the pre-processor processes code?
Read with this
Predeclarations instead of #include
Predeclarations instead of #include
More like this
Make Dependency Files for C/C++ Headers
Make Dependency Files for C/C++ Headers
More like this
What problem is created if a header file is included twice?
What problem is created if a header file is included twice?
More like this