|
|
|
|
#ifndef CLASS_NAME_H
used as more or less the standard and not #pragma once
and how does the preprocessor handle both cases?
#pragma once
not mentioned in the article is that with it, the include guard is not predictable. This may be of importance if your program has a large number of header files (say 500) with deeply nested nested #include directives.
16.6 Pragma directive [cpp.pragma] 1 A preprocessing directive of the form # pragma pp-tokensopt new-line causes the implementation to behave in an implementation-defined manner. The behavior might cause translation to fail or cause the translator or the resulting program to behave in a non-conforming manner. Any pragma that is not recognized by the implementation is ignored. |
#pragma once
because I actually learned this way when I was doing my work placement with a huge multinational company.