如何检查使用的是c99,而不是gnu99

发布于 2024-12-23 04:44:04 字数 195 浏览 4 评论 0原文

我想在编译过程中添加一条警告消息,警告用户应该使用gnu99而不是c99(我使用的是匿名结构,似乎它在c99中根本不存在)。

我发现:

#if __STDC_VERSION__ >= 199901L

但是这个测试对于c99和gnu99是正确的。

我可以使用哪个预定义宏?

I want to add a warning message during the compilation to warn the user it should use gnu99 instead of c99 (I am using anonymous struct, and it seems it doesn't exist at all in c99).

I found that:

#if __STDC_VERSION__ >= 199901L

but this test is true for c99 and gnu99.

Which predefined macro could I use?

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

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

发布评论

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

评论(1

蓝天 2024-12-30 04:44:04

您可以自行检查:

$ gcc -std=c99 -dM -E - < /dev/null > c99.txt
$ gcc -std=gnu99 -dM -E - < /dev/null > gnu99.txt
$ sdiff -s c99.txt gnu99.txt
#define __STRICT_ANSI__ 1                     <

You can check for yourself:

$ gcc -std=c99 -dM -E - < /dev/null > c99.txt
$ gcc -std=gnu99 -dM -E - < /dev/null > gnu99.txt
$ sdiff -s c99.txt gnu99.txt
#define __STRICT_ANSI__ 1                     <
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文