Generating code for the switch statement

John Owens jso at edison.UUCP
Fri Aug 15 08:13:49 AEST 1986


In article <610 at hropus.UUCP>, ka at hropus.UUCP (Kenneth Almquist) writes:
> If the cases are not consecutive, the branch table must be filled with
> entries for the "missing" cases, making the table larger.  [....]  If
> the cases are mostly consecutive with a few outliers, a branch table
> could be augmented with a few specific tests for the outliers, but I
> don't know of any compiler that does this.

The Microsoft Pascal/Fortran compilers, at least some of the old
ones (3.04 and 3.11) do this.  I haven't tried it to see if their
wonderful new code generators do.

	John Owens @ General Electric Company	(+1 804 978 5726)
	jso%edison.UUCP at seismo.CSS.GOV			[arpa]
	jso at edison.UUCP					[w/ uucp domains]
	{cbosgd allegra ncsu xanth}!uvacs!edison!jso	[roll your own]



More information about the Comp.lang.c mailing list