奇思妙想 · 2024年 5月 4日 0

如何查看编译器提示存在非标准代码?

52 次浏览

GCC提供-pedantic选项可以在发现非标准C/C++代码时,显示警告信息。
The -pedantic option directs GCC to print a warning message if any of these features is used.

  • 比如使用case范围匹配:
    警告:在 switch 语句中使用范围表达式不符合标准 [-Wpedantic]