Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: c code "beautifier"

Author: Tord Romstad

Date: 03:46:45 12/03/03

Go up one level in this thread


On December 02, 2003 at 13:38:06, Georg v. Zimmermann wrote:

>Now I need some source code beautifier which can produce smth like (my prefered
>style):
>
>if (ifClauseExample)
>{
>      for (forExample = 1; ;)
>      {
>            if (oneLineIf)
>                  shouldLookLikeThis();
>      }
>}

I've always wondered why people like to have lines containing only a
brace and nothing else.  It limits the amount of code you can see on
the screen without scrolling (or the amount of code which fits on one
page of a printout) without adding any information at all.  It also
doesn't improve the readability, if you read the block structure by
indentation rather than by counting braces.

I would have written the above code like this:

if (ifClauseExample) {
  for(forExample = 1; ;) {
    if(oneLineIf)
      shouldLookLikeThis(); }}

Much more compact and readable, IMHO.

Tord



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.