Evan wrote:
Is there any standard for when to use #if
!defined(SOME_INCLUSION_GUARD) versus #ifndef SOME_INCLUSION_GUARD?
Both are perfectly fine in Standard C++,
However, if you are actually writing an inclusion guard or
similar which defines a macro immediately afterwards, an
#ifndef and a #define on the subsequent line, match up quite
nicely, as you can see:
#ifndef A
#define A
....
#endif
It's just a matter of preference, style or coding standards.
Also, how widely is #pragma once supported?
What a #pragma does is entirely up to a compiler, and an
unknown #pragma is ignored. So it's "supported" everywhere,
but only causes the specific behavior you have in mind
on those compilers for which you know for certain that it
causes that specific behavior.
S