How to check that c99 is used, and not gnu99

十年热恋 提交于 2019-12-08 07:06:48

问题


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?


回答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                     <


来源:https://stackoverflow.com/questions/8656175/how-to-check-that-c99-is-used-and-not-gnu99

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!