Your #include habits

Started by
9 comments, last by ToohrVyk 15 years, 5 months ago
Quote:Original post by Rohithzhere
Also, in such cases u can add "#pragma once" to instruct the compiler to ignore redundant data amongst the prevailing headers.
No. '#pragma once' (besides being non-standard) merely avoids multiple inclusion of a given file within the same translation unit.

If you include MyStruct.h in Functions.h, then changing MyStruct.h will cause every file that includes Functions.h to be compiled again, even when it doesn't use MyStruct.h or anything defined inside it, and #pragma once will not be able to do anything about it.

Changing a file and having a 30-minute recompile is pretty annoying in large projects.

This topic is closed to new replies.

Advertisement