`#pragma Once` 是否已进入 C++0x 中?

发布于 2024-10-10 08:40:11 字数 97 浏览 0 评论 0原文

标题说明了一切。 #pragma Once 是否已经针对 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

街道布景 2024-10-17 08:40:11

所有#pragma 指令都会导致实现以实现定义的方式运行。

这在 C++03 和最新的 C++0x 草案 (n3225.pdf) 之间没有改变。包括防护装置是便携式替代方案。

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.

苍景流年 2024-10-17 08:40:11

Sun C++ 编译器 (Solaris) 未实现它。不,它不在 C++0x 草案中。

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

定格我的天空 2024-10-17 08:40:11

使用#ifdef 实现也很简单。新版本的指导原则是什么?实现您可能想要的一切和厨房水槽,还是只为您提供最少的工具来自己实现这一点?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文