Re: Exit(n) vs. goto

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

-------Phoenix-Boundary-07081998-

Hi Derek Parnell, you wrote on 2/17/02 4:39:07 PM:

>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;
>   }

blink Just to be opinionated smile

   if (cond1) {
      if (cond2) {
         RtnA;
         }
      }
   else {
      RtnB;
      }

Reasons:
1) Blank (or nearly blank) lines should be used as
   'visual separators' to group related chunks of
   code. (Unless you are getting paid by the line,
   of course). One rarely wants to interrupt the
   reader just after an if clause starts.

2) To my view, the '{}' after if are part of the
   contents of the if clause, and deserve to be
   indented just like the other contents.

3) Nobody else does it this way (It must be better).


Karl

-------Phoenix-Boundary-07081998---

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

Search



Quick Links

User menu

Not signed in.

Misc Menu