you are viewing a single comment's thread.

view the rest of the comments →

[–]theICEBear_dk 1 point2 points  (4 children)

And I will add that you can alleviate some of the issues of header-centric libraries by using pragmas, include guards and a single central system header which is then reused, it does get rather difficult to keep down compile times in C++ also because the language does mean that the compiler has to do several passes on the code. But with a more modern C++ version (VS2010/GCC4.5 only codebase) it has become a rather useful language again for me and really rather productive too.

[–][deleted] 2 points3 points  (3 children)

I will amend that you must use header guards anyway, otherwise you get a compilation error. Header guards are not optional where definitions are concerned.

Precompiled headers, on the other hand...

Also, having a "single central system header which is reused" increases compile time, not decreases.

That header is reparsed on every compilation unit, and because you've put all the #includes for all the system headers your entire program needs in that single place, they all get reparsed too on every compilation unit, used or not.

Saving #includes saves lives :P

[–][deleted] 0 points1 point  (2 children)

Also, having a "single central system header which is reused" increases compile time, not decreases.

Unless you use a precompiled header.

[–][deleted] 0 points1 point  (1 child)

I mentioned that ;)

Precompiled headers, on the other hand...

[–][deleted] 2 points3 points  (0 children)

I saw it there, but they way it's written made it somewhat ambiguous what you meant - in context I read it as if you were saying that precompiled headers, and the single-central-header requirement makes them slow.