MLUG: Re: [MLUG] Quick programming question on style
Re: [MLUG] Quick programming question on style
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On 6/3/05, Nathaniel Green <EMAIL:PROTECTED> wrote:
>
> if (testcase == 1) {
> //stuff
> } //end if testcase
> 
> It usually helps keep me from getting lost in a sea of brackets.
> 

I *don't* like that one, for several reaons:

1) Comments can lie.  What if you edit the code and screw up the
braces?  Then the comment may refer to the wrong thing, wasting
debugging time.

2) Any decent text editor will tell you what the matching
parenthesis/brace is.  Emacs does this with zero keystrokes.  The
editor doesn't lie.

3) Whenever I have too many braces and the code becomes confusing, it
is a sure sign  that I need break the program into smaller pieces.

I do like the " //end if " convention when it comes to huge chunks of
code that are #ifdef'd. At least when I'm reading other people's code.

Regards,
Mark
EMAIL:PROTECTED
-- 
You think that it is a secret, but it never has been one.
  - fortune cookie

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members