git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Make git-clean a builtin

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 7, 2007, 15:04 UTC
Message-ID
<Pine.LNX.4.64.0711071501270.4362@racer.site>
In-Reply-To
<20071107145434.GB6768@mediacenter.austin.rr.com>
Hi,
On Wed, 7 Nov 2007, Shawn Bohrer wrote:
Show 19 quoted lines
> On Wed, Nov 07, 2007 at 11:10:45AM +0000, Johannes Schindelin wrote:
> > 
> > you still have quite a number of instances where you wrap just one line 
> > into curly brackets:
> > 
> > 	if (bla) {
> > 		[just one line]
> > 	}
> 
> Crap.  OK I count one instance unless you count:
> 
> 	if (foo) {
> 		one_line();
> 	} else if (bar) {
> 		one_line();
> 		two_lines();
> 	} else {
> 		something_else();
> 	}

I do count them. Personally, I find it highly distracting and ugly. Besides, we have the convention of putting the "}" not into the same line as "else". (See keyword "uncuddling" in the list archives.)

While it may be true that some parts of the code follow these rules less strictly, it does not mean that we should introduce more of that kind.

BTW there are plenty of examples in the existing code which illustrate our implicit coding conventions.

> Now I suppose I can get rid of the curly braces here as well but I 
> personally find that strange and ugly.  So is there an official 
> guideline on if else statements?

Not yet ;-) I can add it to the tentative v3 of Documentation/CodingStyle or CodingConventions or however the list would like to name it.

Ciao, Dscho

Previous: Shawn BohrerNext: Brian Downing
Message 9 of 13 in “Make git-clean a builtin”
  1. Make git-clean a builtinShawn Bohrer, Nov 7, 2007
  2. Johannes SchindelinNov 7, 2007
  3. Bill LearNov 7, 2007
  4. Johannes SchindelinNov 7, 2007
  5. Matthieu MoyNov 7, 2007
  6. Jon LoeligerNov 7, 2007
  7. Miles BaderNov 10, 2007
  8. Shawn BohrerNov 7, 2007
  9. Johannes SchindelinNov 7, 2007
  10. Brian DowningNov 7, 2007
  11. Junio C HamanoNov 7, 2007
  12. Junio C HamanoNov 7, 2007
  13. Shawn BohrerNov 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.