Klaim
Klaim

Reputation: 69792

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.

Upvotes: 11

Views: 2990

Answers (3)

Jay
Jay

Reputation: 14481

It's also trivial to implement using #ifdef. What's the guiding principal for the new version? Implement everything you might ever want and the kitchen sink or just give you the minimum tools to do so yourself?

Upvotes: -2

CB Bailey
CB Bailey

Reputation: 793199

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.

Upvotes: 13

zeuxcg
zeuxcg

Reputation: 9404

Sun C++ compiler (Solaris) does not implement it. And no, it's not in C++0x drafts.

Upvotes: 6

Related Questions