Search code examples
c++c++11c-preprocessorpragma

Did `#pragma once` make it into C++0x?


The title says it all. Have #pragma once been standardized for C++0x? I don't know any compiler that doesn't provide an implementation of it, with almost always the same semantics and name.


Solution

  • All #pragma directives cause the implementation to behave in an implementation defined way.

    This hasn't changed between C++03 and the latest C++0x draft (n3225.pdf). Include guards are the portable alternative.