This is gcc extension , the easiest way to find out is with gcc , at least use the -pedantic argument:
gcc -pedantic
will warn:
warning: range expressions in switch statements are non-standard [-pedantic]
and if you want to check a specific standard, for example c99 , follow these steps:
gcc -std=c99 -pedantic
Also, this is not true:
case 1...9:
you need spaces between dots and numbers:
case 1 ... 9:
as noted in the document :
Be careful: create spaces around ... otherwise it may not be parsed correctly when you use it with integer values.
source share