On 2005-05-19 14:18 PM, Anh Vo wrote:
> I would like to know if "#pragma once" is part of ISO C++
> standard or not.
It is not. The C++98 standard (ISO/IEC 14882) doesn't specify
any particular pragma as standard or even recommended.
> Obviously, gcc-3.0 or later supports it.
I was going to say it's deprecated by gcc, but I checked first:
| File handling in the preprocessor has been rewritten. GCC
| no longer gets confused by symlinks and hardlinks, and now
| has a correct implementation of #import and #pragma once.
| These two directives have therefore been un-deprecated.
That seems to say it was present but not correct through
But what are you trying to accomplish? Why consider using a
nonstandard feature anyway? Are normal include guards not
adequate for your task?
From: John Gaughan <john@jo...> - 2005-05-19 22:52:21
Anh Vo wrote:
> I would like to know if "#pragma once" is part of ISO C++ standard or
> not. Obviously, gcc-3.0 or later supports it. Thanks in advance for
> your help.
Section 16.6 of the standard says that the #pragma directive is
implementation-defined as far as what comes after it. Meaning that the
answer to your question is "no."