What is “…” in switch-case in C code

前端 未结 4 1067
慢半拍i
慢半拍i 2020-11-29 05:33

Here is a piece of code in /usr/src/linux-3.10.10-1-ARCH/include/linux/printk.h:

static inline int printk_get_level(const char *buffer)
{
  if (         


        
4条回答
  •  醉梦人生
    2020-11-29 06:14

    Beware, it is not standard C and therefore not portable. It is a shorthand devised for case statements. It's well-defined since in C you can only switch on integral types.

    In standard C, ... is only used in variable length argument lists.

提交回复
热议问题