Re: switch statement

new topic     » goto parent     » topic index » view thread      » older message » newer message
Critic said...
euphoric said...

Okay, now I remember why it was a good idea. SPEEEEEEEEEED!!! grin

Speed is no justification for a bad syntax (a "select" statement can be optimized just like a "switch"). Apart from that, an "if"-"elsif"-statement can be optimized into a jump table too.

Bad syntax is often subjective.

Not all if-elsif-else statements can be optimized this way (think side effectsbad practice, but still needs to be taken into account), but your statement is just referring to a trivial isomorphism between a switch and if-elsif-else blocks. By which I mean that all switches (that don't use fallthrough) can be trivially altered to be an if-elsif-else.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu