如何在gcc中获取当前的c语言? [英] How to get current c dialect in gcc?
本文介绍了如何在gcc中获取当前的c语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
C编程新手.
在gcc -std
中设置要编译的C标准,例如gcc -std=c99
.
可以知道当前设置了哪个C标准?
Newbie in C programming.
In gcc -std
sets the C standard that compiles, e.g. gcc -std=c99
.
It's possible to know which C standard is currently set?
推荐答案
您可以使用此程序打印默认值:
You can use this program to print the default:
#include <stdio.h>
int main() {
#ifdef __STRICT_ANSI__
printf("c");
#else
printf("gnu");
#endif
#ifdef __STDC_VERSION__
#if __STDC_VERSION__ == 199901L
puts("99");
#elif __STDC_VERSION__ == 201112L
puts("11");
#else
puts("(unknown)");
#endif
#else
puts("90");
#endif
return 0;
}
这篇关于如何在gcc中获取当前的c语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文