Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!petrus!scherzo!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!brl-adm!brl-smoke!smoke!dietz%slb-doll.csnet@CSNET-RELAY.ARPA From: dietz%slb-doll.csnet@CSNET-RELAY.ARPA (Paul Dietz) Newsgroups: net.lang.c Subject: What happened to label variables? Message-ID: <1427@brl-smoke.ARPA> Date: Sat, 1-Mar-86 22:46:04 EST Article-I.D.: brl-smok.1427 Posted: Sat Mar 1 22:46:04 1986 Date-Received: Mon, 3-Mar-86 00:39:00 EST Sender: news@brl-smoke.ARPA Lines: 32 >> [the lack of label varibles in C] is unfortunate... >I don't think you will get much sympathy on this point. I certainly wasn't suggesting the use of label variables by human programmers. However, like gotos, they make writing source-to-source translators easier in some cases (such as mine). You suggested: > switch(labelindex) { > case 1: label1: break; > case 2: label2: break; > ... > case n: labeln: break; > default: fprintf(stderr,"unknown label index: %d\n", > labelindex); > abort(); > } Unfortunately, this doesn't always work. Some of the label1 ... labeln may be inside additional switch statements. In any case, using a switch statement is still slower than a jump to a label variable, since the object code must check if the index is out of range (the VAX does this in microcode but it's still slower than a jump). >> [Do any current compilers have indirect jumps...?] > Probably not. I think they all wised up. Why don't you? Because I want to generate C, and I want efficient code. The switch hack is contorted and inefficient.