Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/bin/sh



Roland Illig <rillig%netbsd.org@localhost> writes:

> sh: ignore lint error about 'continue' in 'do while' loop
>
> exec.c(575): error: continue in 'do ... while (0)' loop [323]
> jobs.c(203): error: continue in 'do ... while (0)' loop [323]
>
> It is certainly a rarely used feature, I saw it the first time today
> and I don't see why a 'continue' statement in a 'do while' loop should
> be an error.

The only reason I can think of for using a 'do ... while (0)' construct
outside of a '#define' is to have a block that's executed once, but that
you can break out of without having to use 'goto'.  When you do this,
the keywords 'break' and 'continue' both break out of the block.  I
guess what lint is saying here is that because of this, you should use
'break', and not 'continue', to make it explicit what's happening.

-tih
-- 
Most people who graduate with CS degrees don't understand the significance
of Lisp.  Lisp is the most important idea in computer science.  --Alan Kay


Home | Main Index | Thread Index | Old Index