Re: What do you think about the code?



Frederick Gotham wrote:
Ian Collins posted:



I agree 100% with Richard's comments, the cleaner the code structure,
the easier it is to refactor. That's why my last team banned goto
outright.



I find "goto" necessary when I have nested loops, for example:

Apply more imagination.

while ( expr1 )
{
while ( expr2 )
{
while ( expr3 )
{
goto OUT_OF_ALL_LOOPS;
}
}
}

OUT_OF_ALL_LOOPS: ;

I posted a viable alternative last week.

In my own humble opinion, I think it's childish to outright ban something
when it comes to computer programming -- I feel it gives an air of
inconfidence in one's competence.

Well that's team democracy at work. We preferred well structured code
that was easy to refactor. Try extracting your inner loop to a function.

--
Ian Collins.
.



Relevant Pages

  • Re: What do you think about the code?
    ... the easier it is to refactor. ... That's why my last team banned goto ... I find "goto" necessary when I have nested loops, ... I think it's childish to outright ban something ...
    (comp.lang.c)
  • Re: What do you think about the code?
    ... That's why my last team banned goto ... I think it's childish to outright ban something ... while (expr3 &&!done) ... lot of good archives). ...
    (comp.lang.c)