I was browsing some code in the linux kernel and I came across the statements like case '0' ... '9':
To try this out I created the test program below.
#include <iostream>
int main()
{
const int k = 15;
switch (k)
{
case 0 ... 10:
std::cout << "k is less than 10" << std::endl;
break;
case 11 ... 100:
std::cout << "k is between 11 and 100" << std::endl;
break;
default:
std::cout << "k greater than 100" << std::endl;
break;
}
}
The program above does compile although I have never come across the elipses in case statement construct before. Is this standard C and C++ or is this a GNU specific extension to the language?