From mboxrd@z Thu Jan 1 00:00:00 1970 From: doug@cs.dartmouth.edu (Doug McIlroy) Date: Thu, 08 Sep 2016 22:43:35 -0400 Subject: [TUHS] Comments on "C" Message-ID: <201609090243.u892hZnO042852@tahoe.cs.Dartmouth.EDU> I sent a similar message some time ago, but I haven't seen it appear in the mailing list, so here goes again. Apologies if it ends up as a duplicate. > After about 30 years of C, there are only three things I would have liked > to see: > > 1. Computed goto > ... > Computed goto's are good for interpreters. A computed goto is an optimized switch, and that optimization goes back to the original C compiler. Mostly driven by considerations of size and speed of the Unix kernel, Dennis quite early on taught the compiler to choose among three compilation strategies for a switch: a chain of comparisons, a tree of comparisons, or a computed goto, depending on the number and density of alternatives. The compilation of the system-call dispatch table was a perfect example of "good for interpreters." I have always assumed that other mainline compilers behave similarly, but I have no solid knowledge about that. doug