Programmer's Wiki
Advertisement

How are C switches "quite dissimilar" to Algol 60 switches?[]

I read in the article that "switches of C and other curly-braces-PL:s are quite dissimilar" to Algol 60 switches. I don't see a big difference. Apart from the fact that the labels in a C switch statement are implicitly defined to be at the case labels in the block contained in the switch, with the correspondence between those labels and the integers that select the label given by the values mentioned at those case labels, this is still basically a multi-way branch to a program location (label) given by a fixed array of possibilities, selected by an integer index. It is somewhat different syntactically, but semantically still the same (but with the restriction that jumps can only be forward). Am I missing something here? Marc van Leeuwen (talk)

Advertisement