Linux 下centos 查看 -std 是否支持 C17

这篇具有很好参考价值的文章主要介绍了Linux 下centos 查看 -std 是否支持 C17。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

实际工作中,可能会遇到c++的一些高级特性,例如std::invoke,此函数是c++17才引入的,如何判断当前的gcc是否支持c++17呢,这里提供两种办法。
1.根据gcc的版本号来推断
gcc --version,可以查看版本号,笔者的电脑,gcc的版本号是8.3.0,然后查看8.3.0是什么时候发布的,查出是2019年发布的,从而推断出是支持,但是不是十分肯定,所以接着看第二种方法
2.直接man gcc
Linux 下centos 查看 -std 是否支持 C17,Liunx,linux,centos,运维

上图中,红色方框-std=表示支持的标准项,可以看到c11,c17之类的

centos 本身自带的版本是不支持到C17的。截取 man gcc如下文章来源地址https://www.toymoban.com/news/detail-605954.html

 -std=
           Determine the language standard.   This option is currently only supported when compiling C or
           C++.

           The compiler can accept several base standards, such as c90 or c++98, and GNU dialects of those
           standards, such as gnu90 or gnu++98.  When a base standard is specified, the compiler accepts all
           programs following that standard plus those using GNU extensions that do not contradict it.  For
           example, -std=c90 turns off certain features of GCC that are incompatible with ISO C90, such as
           the "asm" and "typeof" keywords, but not other GNU extensions that do not have a meaning in ISO
           C90, such as omitting the middle term of a "?:" expression. On the other hand, when a GNU dialect
           of a standard is specified, all features supported by the compiler are enabled, even when those
           features change the meaning of the base standard.  As a result, some strict-conforming programs
           may be rejected.  The particular standard is used by -Wpedantic to identify which features are
           GNU extensions given that version of the standard. For example -std=gnu90 -Wpedantic warns about
           C++ style // comments, while -std=gnu99 -Wpedantic does not.


            A value for this option must be provided; possible values are

           c90
           c89
           iso9899:1990
               Support all ISO C90 programs (certain GNU extensions that conflict with ISO C90 are
               disabled). Same as -ansi for C code.

           iso9899:199409
               ISO C90 as modified in amendment 1.

           c99
           c9x
           iso9899:1999
           iso9899:199x
               ISO C99.  Note that this standard is not yet fully supported; see
               <http://gcc.gnu.org/c99status.html> for more information.  The names c9x and iso9899:199x are
               deprecated.

           c11
           c1x
           iso9899:2011
               ISO C11, the 2011 revision of the ISO C standard.  Support is incomplete and experimental.
               The name c1x is deprecated.

           gnu90
           gnu89
               GNU dialect of ISO C90 (including some C99 features). This is the default for C code.

           gnu99
           gnu9x
               GNU dialect of ISO C99.  When ISO C99 is fully implemented in GCC, this will become the
               default.  The name gnu9x is deprecated.

           gnu11
           gnu1x
               GNU dialect of ISO C11.  Support is incomplete and experimental.  The name gnu1x is
               deprecated.

           c++98
           c++03
               The 1998 ISO C++ standard plus the 2003 technical corrigendum and some additional defect
               reports. Same as -ansi for C++ code.

           gnu++98
           gnu++03
               GNU dialect of -std=c++98.  This is the default for C++ code.

           c++11
           c++0x
               The 2011 ISO C++ standard plus amendments.  Support for C++11 is still experimental, and may
               change in incompatible ways in future releases.  The name c++0x is deprecated.
 gnu++11
           gnu++0x
               GNU dialect of -std=c++11. Support for C++11 is still experimental, and may change in
               incompatible ways in future releases.  The name gnu++0x is deprecated.

           c++1y
               The next revision of the ISO C++ standard, tentatively planned for 2017.  Support is highly
               experimental, and will almost certainly change in incompatible ways in future releases.

           gnu++1y
               GNU dialect of -std=c++1y.  Support is highly experimental, and will almost certainly change
               in incompatible ways in future releases.


到了这里,关于Linux 下centos 查看 -std 是否支持 C17的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Linux查看端口是否开放

    1. 使用rpm安装nmap工具,执行 \\\"nmap 127.0.0.1\\\" 命令查看本机开放的端口 2. 执行 \\\"netstat -anp\\\" 命令进行查看开放的端口 3. 使用rpm安装slof工具,执行 \\\" lsof -i:8085\\\" 命令查看本机的开放的端口 1:使用nmap 工具检测开放的端口         nmap是一款网络扫描和主机检测的工具。 通过yum i

    2024年02月07日
    浏览(30)
  • Linux-如何查看Linux系统是否开通sshd服务

    输入 setup 命令,选择 系统服务 ,查看 sshd 服务前面是否有 * 号,有 * 号表示已开启该服务。 服务前面有 * 号表示已开启该服务。 参考资料:https://www.bilibili.com/video/BV1dW411M7xL/?p=13 如果该命令返回类似于 active (running) 的结果,则表示sshd服务已经在运行中。 如果SSH服务已启用

    2024年04月27日
    浏览(31)
  • Linux如何查看Nginx是否启动

    介绍: Nginx是一个高性能的反向代理服务器,现在一般作为我们网站或其他Web服务的第一层代理,它负责监听80端口,用户通过浏览器发送的请求首先经过的就是Nginx服务。如果Nginx没有启动或异常结束就会影响Web服务的正常使用。 那么如何在Linux中查看Nginx是否启动呢 命令

    2024年02月12日
    浏览(41)
  • Linux查看tomcat是否启动,查看tomcat监听端口

    查看tomca是否启动 搜索tomcat安装路径 进入tomca目录,conf目录,找到server.xml 找到tomcat端口 查看该端口进程 167835端口与第一步对应,tomct启动成功

    2024年02月01日
    浏览(35)
  • 查看linux中程序是否被系统杀死,如何查看日志

    最近在linux开发日常中,维护之前发布的程序,几台服务器只有一台在重启,而且不定期,查看服务日志也没有任何signal信号以及服务挂掉的原因打印,迫于无奈怀疑是linux系统给服务干掉了。于是想查看服务被杀掉的日志,看看系统日志,即可判断。 即途中目录下的message

    2024年02月05日
    浏览(42)
  • Linux查看某一端口是否开放

    lsof -i:6379 //如果有显示说明已经开放了,如果没有显示说明没有开放 [root@localhost ~]# lsof -i:6379 netstat -aptn |grep -i 6379 //查看是否监听在0.0.0.0:6379 netstat -lptn |grep -i 6379 //查看TCP类型的端口 netstat -lpun |grep -i 6379 //查看UDP类型的端口 telnet 127.0.0.1 6379 //telnet IP 端口号

    2024年02月10日
    浏览(43)
  • Linux如何查看服务启动状态是否开机自动启动

    本文为joshua317原创文章,转载请注明:转载自joshua317博客 Linux如何查看服务启动状态是否开机自动启动 - joshua317的博客 linux中查看服务启动状态是否开机自动启动的方法: 1、打开linux终端; 2、在终端命令行中输入“chkconfig --list servicename”命令查看服务启动状态是否开机自动

    2023年04月09日
    浏览(39)
  • Linux CentOS7.9安装OpenJDK17

    清华大学开源软件镜像站 国内的站点,下载速度贼快 上传到自己指定的目录,我一般在丢在这个目录 /home/local/java/ 下 文件上传到服务器后,解压命令:

    2024年02月06日
    浏览(41)
  • 【Linux】查看指定端口的UDP、TCP是否收到数据【2023.07.24】

      场景是终端上报数据给服务端,会有前端进行展示。通过wireshark看到终端给服务端发送数据了,但是UDP无法确定服务端是否正确收到,于是需要在Linux执行一些命令查看是否收到数据。 这个命令会抓取发往或从端口12222的UDP数据报文。 其中: -i enp2s0:指定抓取接口enp2s0上的

    2024年02月15日
    浏览(46)
  • 可使用Linux 测试IP和端口是否能访问,查看返回状态码

    wget是linux下的下载工具,需要先安装. 用法: wget ip:port 连接存在的端口 telnet是windows标准服务,可以直接用;如果是linux机器,需要安装telnet. 用法: telnet ip port

    2024年02月13日
    浏览(29)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包