当前位置: 首页 > news >正文

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
![[Pasted image 20230321110013.png]]

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

centos 本身自带的版本是不支持到C17的。截取 man gcc如下

 -std=Determine the language standard.   This option is currently only supported when compiling C orC++.The compiler can accept several base standards, such as c90 or c++98, and GNU dialects of thosestandards, such as gnu90 or gnu++98.  When a base standard is specified, the compiler accepts allprograms following that standard plus those using GNU extensions that do not contradict it.  Forexample, -std=c90 turns off certain features of GCC that are incompatible with ISO C90, such asthe "asm" and "typeof" keywords, but not other GNU extensions that do not have a meaning in ISOC90, such as omitting the middle term of a "?:" expression. On the other hand, when a GNU dialectof a standard is specified, all features supported by the compiler are enabled, even when thosefeatures change the meaning of the base standard.  As a result, some strict-conforming programsmay be rejected.  The particular standard is used by -Wpedantic to identify which features areGNU extensions given that version of the standard. For example -std=gnu90 -Wpedantic warns aboutC++ style // comments, while -std=gnu99 -Wpedantic does not.A value for this option must be provided; possible values arec90c89iso9899:1990Support all ISO C90 programs (certain GNU extensions that conflict with ISO C90 aredisabled). Same as -ansi for C code.iso9899:199409ISO C90 as modified in amendment 1.c99c9xiso9899:1999iso9899:199xISO 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 aredeprecated.c11c1xiso9899:2011ISO C11, the 2011 revision of the ISO C standard.  Support is incomplete and experimental.The name c1x is deprecated.gnu90gnu89GNU dialect of ISO C90 (including some C99 features). This is the default for C code.gnu99gnu9xGNU dialect of ISO C99.  When ISO C99 is fully implemented in GCC, this will become thedefault.  The name gnu9x is deprecated.gnu11gnu1xGNU dialect of ISO C11.  Support is incomplete and experimental.  The name gnu1x isdeprecated.c++98c++03The 1998 ISO C++ standard plus the 2003 technical corrigendum and some additional defectreports. Same as -ansi for C++ code.gnu++98gnu++03GNU dialect of -std=c++98.  This is the default for C++ code.c++11c++0xThe 2011 ISO C++ standard plus amendments.  Support for C++11 is still experimental, and maychange in incompatible ways in future releases.  The name c++0x is deprecated.gnu++11gnu++0xGNU dialect of -std=c++11. Support for C++11 is still experimental, and may change inincompatible ways in future releases.  The name gnu++0x is deprecated.c++1yThe next revision of the ISO C++ standard, tentatively planned for 2017.  Support is highlyexperimental, and will almost certainly change in incompatible ways in future releases.gnu++1yGNU dialect of -std=c++1y.  Support is highly experimental, and will almost certainly changein incompatible ways in future releases.
http://www.lryc.cn/news/96770.html

相关文章:

  • 【算法训练营】字符串转成整数
  • 入局元宇宙,所谓的无限可能到底在哪里?
  • 为什么 SSH(安全终端)的端口号是 22 !!
  • k8s Label 2
  • layui踩坑记录之form表单下的button按钮默认自动提交
  • 2-vi和vim的使用
  • 微服务——Nacos配置管理
  • 如何为WordPress博客网站配置免费域名HTTPS证书
  • React之内置的高阶组件
  • 【kubernetes系列】flannel之vxlan模式原理
  • PostgreSQL -- 备份恢复命令
  • 【基于Spark的电影推荐系统】环境准备
  • 团簇大小分布计算方法,fix ave/histo命令详解
  • CAN标准帧和拓展帧
  • android 清除缓存方法
  • 介绍下你们项目中各微服务之间怎么调用的?
  • MySql提示:The Server Quit Without Updating PID File(…)失败 103.36.167
  • FPGA学习——按键消抖的两种实现方法
  • SecureCRT如何将复制的内容粘贴到word中仍然保持原有字体颜色
  • 微信小程序分享页面代码
  • Hadoop 之 Hbase 配置与使用(四)
  • 使用TensorFlow和VGG-19模型实现艺术风格迁移:一步一步打造你的数字艺术世界
  • FBX/GLTF在线转换
  • Tensorflow(二)
  • NoSQL之 Redis 部署,配置与优化
  • 汽车行业 Y 公司对接斯堪尼亚 SCANIA EDI 项目案例
  • mysql到doris踩坑记录(如果有问题希望大家帮忙指出问题)
  • 苹果11手机设置手机跟踪功能
  • 下拉框可筛选可树状多选组件
  • 【LeetCode】70.爬楼梯