3 ms·
Most of the advice holds true, but there's one bit you should happily ignore: don't uglify your code with external include guards - that is put your include gua
by unscaled 10y ago
Most of the advice holds true, but there's one bit you should happily ignore: don't uglify your code with external include guards - that is put your include guards in the included file.
Modern compilers perform include guard optimization:
http://www.bobarcher.org/software/include/results.html http://www.bobarcher.org/software/include/results.html
There is one exception to this rule which I think still holds true: MSVC doesn't perform this optimization correctly, perhaps due to its love affair with precompiled headers.
I personally prefer solving that issue with pragma once, as I find the risk of having an include guard name clash higher than the chance of having two the same file accessible between to different hardlinks or copies, let alone compiling anything on network share. It's also a lot more readable.