No more fall through in case statement?
Christopher Wright
dhasenan at gmail.com
Sat Jan 5 04:43:13 PST 2008
BC wrote:
> On Fri, 04 Jan 2008 17:26:54 -0000, Janice Caron
> <caron800 at googlemail.com> wrote:
>> The way I see it, the advantage of "switch/case" over "if" is that the
>> compiler might be able to find cool ways to optimize the code (e.g
>> binary search, sparse array lookup, table lookup, whatever). If the
>> compiler can't do that, well then, what's the point of using it at all
>> when "if" is perfectly expressive already?
>
> Do you know if the compilers actually do this?
I've heard that javac uses table lookups for switch statements.
More information about the Digitalmars-d
mailing list