Trigraphs 不能用 MS 编译器编译?

发布于 2025-01-14 15:32:41 字数 644 浏览 2 评论 0原文

我在 Visual Studio 2019 中有一个使用 Microsoft 编译器的 C++14 项目,我试图理解二合字母和三合字母,所以我的代码有点奇怪:

#include "Trigraphs.h"

void Trigraphs::assert_graphs()
??<
    // How does this ever compile ????/
    ouch!
??>

阅读有关 /Zc:三字母 开关

通过 C++14,像 C 中一样支持三字母。C++17 标准从 C++ 语言中删除了三字母。

我知道三字母组应该在 C++14 之前得到支持,因为它们仅在 C++17 中被删除。然而,在我添加额外的命令行开关之前,上述代码不会使用 C++14 设置进行编译。我的母语不是英语,我对“C++14 之前支持三字母”这句话有什么问题吗?

I have a C++14 project withe the Microsoft compiler in Visual Studio 2019 and I'm trying to understand Digraphs and Trigraphs, so my code is a bit weird:

#include "Trigraphs.h"

void Trigraphs::assert_graphs()
??<
    // How does this ever compile ????/
    ouch!
??>

Reading about the /Zc:trigraphs switch

Through C++14, trigraphs are supported as in C. The C++17 standard removes trigraphs from the C++ language.

I understand that trigraphs should be supported until C++14 because they were removed in C++17 only. Yet, the above code does not compile with C++14 settings until I add the additional command line switch. I am not a native English speaker, did I get something wrong about the sentence that trigraphs are supported until C++14?

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

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

发布评论

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

评论(1

粉红×色少女 2025-01-21 15:32:41

MSDN 还说:

/Zc:trigraphs 选项默认关闭

,并且似乎已经适用于 C++14。尽管这会导致非 100% 一致的 C++ 编译,但大多数程序员实际上宁愿不处理 C++ 三字母组的奇怪符号。

MSDN also says:

The /Zc:trigraphs option is off by default

and that seems to apply for C++14 already. Although that results in a non 100% conformant C++ compilation, most programmers will actually prefer not dealing with the strange symbols of C++ trigraphs.

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