:: Re: [DNG] Studying C as told. (For …
Página Principal
Delete this message
Reply to this message
Autor: Hendrik Boom
Data:  
Para: dng
Assunto: Re: [DNG] Studying C as told. (For help)
On Sat, Jun 25, 2016 at 01:21:33AM +0200, Irrwahn wrote:
> On Fri, 24 Jun 2016 14:33:21 -0400, Steve Litt wrote:
> [...]
> > 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.
>
> Well put. Only to add that a similar argument can be formed
> regarding the more general[1] "goto" statement.[2] Structured
> programming is a virtue, but one has to hang the tenets high
> enough to comfortably walk beneath.[3]
>
> IMHO the people that (ab)used Dijkstra's famous essay (with
> the original title "A Case Against the Goto Statement") as
> the foundation of some kind of religion did him and the
> programming community as a whole a bad service. For the
> interested, David Tribble's "Go To Statement Considered
> Harmful: A Retrospective"[4] makes for a good read.


If you actually read Dijkstra's original letter, you'll find he is
concerned with devising some kind of coordinates for measuring progress
through execution, so that proofs of correctness can be hung on them, so
to speak. break and continue are both forms of early exit from a
statement, and do not interfere with his reasoning. The more general go
to anywhere doed interfere. break ad continue are still another form of
control flow, so they do require extra thinking, but they do not
interfere with his methods of tracking progress.

-- hendrik