On Thu, 23 Jun 2016 23:34:23 -0400 (EDT)
Peter Olson <[email protected]> wrote:

> > On June 23, 2016 at 10:48 AM Edward Bartolo <[email protected]>
> > wrote: if (count > 0)
> >     while(putchar(' ') && --count);  
> 
> I strongly recommend using the continue statement here:
> 
>       while(putchar(' ') && --count) continue;
> 
> The reason is that the semicolon by itself is almost unnoticeable and
> you can create a difficult to understand malfunction if you don't
> notice you forgot to type it.

The continue statement isn't without its costs. Like break and goto,
it's a violation of modular programming's "One entry point and one exit
point per block" directive.

Of course in this case it's not a problem because it's the only
statement in the body of the loop, but I just wanted to make that
point.

I often use continue and break, but every time I do, I make a mental
note that I'm decreasing modularity and thus reducing the scalability
of my code. Of course, I might have also increased my code's
readability by reducing redundant indentation. It's a tradeoff.

SteveT

Steve Litt
June 2016 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb
_______________________________________________
Dng mailing list
[email protected]
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to