quote:Original post by Doc
You''re wasting your time. #ifndef... will always work, thus your #pragma once is redundant and pointless.
Include guards will always work and so are recommended, but adding #pragma is a good idea as well.
Include guards require the compiler to open the file, parse the guards, then skip over the contents. By comparison the #pragma method tells the compiler exactly what you want - that the file is to be included once and it does not need to be reopened.
This can have a significant improvement on compile times since less files need to be opened when not needed. By using both methods it is robust on different compilers (though the include guards) and faster to compile on those that support #pragma once.