Quote:
Originally Posted by weaknessforcats
There is no #pragma in ANSI C or C++.
Hmmm, I thought that the #pragma directive was defined in both ANSI C and C++ with the following conditions.
1. The ANSI C and C++ standards do not define any syntax following the #pragma directive since they are compiler dependent commands.
2. The ANSI C and C++ standards does specify that compilers should ignore unrecognised commands (or at least not produce an error halting compilation).
Apart from that I agree, there is little point using the MS specific way when you can use a method supported by everyone.
Even in Visual Studio generated projects the standard method is used in headers. If an MS compiler is detected then it additionally uses the "#pragma once" directive.
In a very large project the advantage of using #pragma once is that the header never even gets opened again during a compile, this can speed up the compile time of the project.