Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
标题说明了一切。是否已#pragma once针对 C++0x 进行了标准化?我不知道任何编译器不提供它的实现,几乎总是具有相同的语义和名称。
#pragma once
所有#pragma指令都导致实现以实现定义的方式运行。
#pragma
这在 C++03 和最新的 C++0x 草案 (n3225.pdf) 之间没有改变。包括警卫是便携式替代品。
Sun C++ 编译器 (Solaris) 没有实现它。不,它不在 C++0x 草案中。
使用#ifdef 实现也很简单。新版本的指导原则是什么?实现您可能想要的一切和厨房水槽,还是只为您提供最少的工具来自己做?