Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: c code "beautifier"

Author: Tord Romstad

Date: 04:45:04 12/03/03

Go up one level in this thread


On December 03, 2003 at 06:50:38, Michel Langeveld wrote:

>On December 03, 2003 at 06:46:45, Tord Romstad wrote:
>
>>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
>
>It's more a personal taste and what your are familiar to.

Yes, of course.  My taste is probably influenced by the fact that my
"native programming language" is Common Lisp.

>Some people like to see
>as much as possible on the screen. Some people like to see where end what code,
>and like to see the braches above each other.

I also like to see where the code blocks begin and end, but I don't need
to the braces because of that.  The block structure is visible from
the indentation.  I don't even notice the braces when I read code.  The
braces are there for the compiler and the editor, the indentation is
there to make the program easily readable for myself.

Tord




This page took 0 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.