本文介绍了什么是" ..."在C code开关情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是 /usr/src/linux-3.10.10-1-ARCH/include/linux/printk.h 一块code的:

 静态内联INT printk_get_level(为const char *缓冲区)
{
  如果(缓冲[0] == KERN_SOH_ASCII&放大器;&放大器;缓冲液[1]){
    开关(缓冲液[1]){
    为'0'...'7':
    案D:/ * * KERN_DEFAULT /
      返回缓冲液[1];
    }
  }
}

它是一种运营商?为什么C程序设计语言不提了?


解决方案

这是一个 GCC 的,这是它是如何在文件中解释说:

You can find a complete list of gcc extensions here. It seems like clang also supports this to try and stay compatible with gcc. Using the -pedantic flag in either gcc or clang will warn you that this is non-standard, for example:

warning: range expressions in switch statements are non-standard [-Wpedantic]

It is interesting to note that Linux kernel uses a lot of gcc extensions one of the extensions not covered in the article is statement expressions.

这篇关于什么是" ..."在C code开关情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 08:02