I\'ve read that there is some compiler optimization when using #pragma once
which can result in faster compilation. I recognize that is non-standard, and thus
I wish #pragma once
(or something like it) had been in the standard. Include guards aren't a real big deal (but they do seem to be a little difficult to explain to people learning the language), but it seems like a minor annoyance that could have been avoided.
In fact, since 99.98% of the time, the #pragma once
behavior is the desired behavior, it would have been nice if preventing multiple inclusion of a header was automatically handled by the compiler, with a #pragma
or something to allow double including.
But we have what we have (except that you might not have #pragma once
).