On Aug 24, 2011, at 08:40, john gilmore wrote:
>
> ...  She did not understand
>
> "The switch statement is a multi-way decision that tests whether an 
> expression matches one of a number of constant integer values , and branches 
> accordingly."
>
> This is understandable since the switch statement, which uses a branch table, 
> does not test anything and would be of little interest if it did.  ...

Which is a detail of implementation, dependent on implementation,
and possibly misleading if asserted dogmatically.

I would hope that a well-designed compiler would resort to a
chain of tests if the set of cases is sparse, and a tree of
tests if it's sparse and numerous.  This ought not affect the
semantics at the higher level.

Should the branch table contain an entry for each member of
the value set of the switch expression?  This might be billions.

-- gil

Reply via email to