Re: strange switch behaviour



Paul Davis wrote:
> On Tue, 2006-02-07 at 12:01 +0000, Bartek Kostrzewa wrote:
> 
>>I know that switch is not particularily well suited for modern programs,
> 
> 
> i don't know what makes you think this. switch() in C/C++ (and some
> other languages) is still one of the most efficient conditional code
> execution constructs in any programming language.
> 

Well, I do agree, but many  of the books that I've read so far explicitly
state that switch should be avoided because it causes jumps that can
lead to hard to find errors

for instance a function executed in the switch statement might prevent
returning to the switch statement after it has been executed, by itself
executing another function which does not stop until the program quits,
hence preventing its completion or the execution of other commands in
that statement [when two "case"'s apply to the same situation for instance]

-Bartek




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]