Using &LABEL

Emperor bright at dataio.UUCP
Wed Sep 19 02:52:50 AEST 1984


I have looked at a number of C compilers (approx. 10), and all of them
generated jump tables for switch statements under the right conditions.
These conditions are generally:
	(max case value - min case value)
	--------------------------------- < (some small constant)
	(total number of cases)

	and (total number of cases) < (another small constant)

When this relation was not true, one of the following algorithms
was generated:
	a sequence of compare-branches
	a table of values and corresponding addresses was searched
	a hard-coded binary tree search
The compilers I looked at included various unix compilers and microprocessor
compilers.



More information about the Comp.lang.c mailing list