RE: Exit(n) vs. goto

new topic     » topic index » view thread      » older message » newer message

In addition to using the braces and indenting uniformly, I also 
routinely outline my code like this:

if (cond) {
}
else {
}

before filling in the substance of it.  This way I know I have my braces 
matching anytime I introduce a begin-end brace pair.

-JoKeR

Derek Parnell wrote:
> >Do you know how ANNOYING trying to chase down { 
> >and } characters are in a deeply nested for & if loop?
> 
> Too bloody right I do. Especially when they are optional!
> 
>    if (cond1)
>        if (cond2)
>            RtnA;
>        else
>            RtnB;
>    
> RtnB gets executed when NOT cond1, and cond2 has nothing to do with it! 
> Which is most confusing.
> 
> >Just for the record, I have no problems with constructing for and if 
> >loops 
> >3-4 levels deep, because as long as it is indented properly, it is very 
> >easy 
> >to understand.
> 
> I too learned the value of consistant indentation sytle with C. I also 
> now always use braces with 
> if/for/while statements.
> 
>    if (cond1)
>    {
>        if (cond2)
>        {
>            RtnA;
>        };
>    }
>    else
>    {
>       RtnB;
>    }
> 
> ---------
> Cheers,
> Derek Parnell 
> 
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu