语境:
/Za, /Ze (Disable Language Extensions) :
... the C compiler conforms strictly to the C89/C90 standard
/permissive- (Standards conformance) :
... and sets the /Zc compiler options for strict conformance
C++ Conformance improvements, behavior changes, and bug fixes in Visual Studio 2019 :
... /permissive may be specified to turn off strict conformance mode in the compiler.
The second option is meant to disable the strict conformance mode ...
clock :
Note that this is not strictly conformant with ISO C99 ...
Walkthrough: Compile a C program on the command line :
MSVC is compatible with the ANSI C89 and ISO C99 standards, but not strictly conforming.
问题:“严格一致性”的定义是什么?是微软发明的吗?
注意:C (n2596.pdf) 和 C++ (n4849.pdf) 标准都没有使用术语“严格符合”/“严格符合”应用于实现。实现要么符合,要么不符合。无渐变。
更新。我的猜测:在“严格一致性”(w.r.t. 到实现)下,微软的意思是“不支持任何扩展的一致性实现”。
最佳答案
您困惑的一个关键部分是 /Za
和/Ze
已被弃用且多年未更新。它是为 ANSI 98 引入的,此后一直没有改变。不要使用这些开关,并忽略文档中对它们的任何引用。
现代 Visual C++“一致性”开关是 /permissive-
和各种 /Zc
开关,结合 /std
.
当前“最符合”的选项是:
/std:c++20
/std:c++17 /permissive- /Zc:preprocessor
. /std:c++14 /permissive- /Zc:preprocessor
. /std:c11
/std:c17
https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch/
Visual C++ 一致性问题的一部分与预处理器有关
https://devblogs.microsoft.com/cppblog/announcing-full-support-for-a-c-c-conformant-preprocessor-in-msvc/
https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/
有关逐个功能的 segmentation ,请参阅 Microsoft Docs
关于c++ - 微软 C/C++ : what is the definition of "strict conformance" w. r.t.执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69575307/