检查GCC 支持的C语言版本

可以使用如下的命令:

gcc -dM -E - < /dev/null

这个命令的解释如下:

       -dCHARS
           CHARS is a sequence of one or more of the following characters, and
           must not be preceded by a space.  Other characters are interpreted
           by the compiler proper, or reserved for future versions of GCC, and
           so are silently ignored.  If you specify characters whose behavior
           conflicts, the result is undefined.

           M   Instead of the normal output, generate a list of #define
               directives for all the macros defined during the execution of
               the preprocessor, including predefined macros.  This gives you
               a way of finding out what is predefined in your version of the
               preprocessor.  Assuming you have no file foo.h, the command

                       touch foo.h; cpp -dM foo.h

               will show all the predefined macros.

               If you use -dM without the -E option, -dM is interpreted as a
               synonym for -fdump-rtl-mach.

       -E  Stop after the preprocessing stage; do not run the compiler proper.  The output is in the form of
           preprocessed source code, which is sent to the standard output.

           Input files that don't require preprocessing are ignored.

后面的 "-"表示标准输入.

在我的电脑上,相关的输出是:

#define __STDC_VERSION__ 201112L

这表示C的版本是2011版本(C11).

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值