public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] USB Storage, add meaningful return value
Date: Tue, 25 Mar 2008 15:40:56 +0100	[thread overview]
Message-ID: <200803251540.56776.sr@denx.de> (raw)
In-Reply-To: <47E90AEF.9010702@freescale.com>

On Tuesday 25 March 2008, Jon Loeliger wrote:
> > It doesn't have braces on the "if (usb_max_devs > 0)" which is
> > syntactically OK but the source of the coding violation.  Please add
> > braces after the "if" and "} else {" per Wolfgang's comments.
> >
> > Thanks for making the code a little better and a little prettier, ;-)
> > gvb
>
> Hey Stefan,

Why me? :)

> What do you think?  Wouldn't a policy of _always_ using
> braces even for single sub-statements have just made this
> a _correct_ no-brainer from the onset? :-)

I think I read some time on LKML, that braces should be used on all multi-line 
paragraphs. So even one statement with a comment should have braces. That's 
what I would prefer. And braces on both parts of the "else" if one needs 
them. So something like is what I would vote for:

	if (a == b) {
		/* some comment */
		c = 1;
	} else {
		c = 2;
	}

But I still prefer using no braces on single line paragraph:

	if (a == b)
		c = 1;
	else
		c = 2;


Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

      parent reply	other threads:[~2008-03-25 14:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-24 23:19 [U-Boot-Users] [PATCH] USB Storage, add meaningful return value Aras Vaichas
2008-03-25  0:07 ` Wolfgang Denk
2008-03-25  0:23   ` Jerry Van Baren
2008-03-25  1:09     ` Aras Vaichas
2008-03-25  7:36       ` Markus Klotzbücher
2008-03-26 18:14       ` Markus Klotzbücher
2008-03-25 14:23     ` Jon Loeliger
2008-03-25 14:34       ` Scott Wood
2008-03-25 14:36         ` Jon Loeliger
2008-03-25 14:40       ` Stefan Roese [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803251540.56776.sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox