public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ed Cogburn <ecogburn@xtn.net>
To: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] CodingStyle fixes for drm_agpsupport
Date: Tue, 12 Aug 2003 05:52:14 -0400	[thread overview]
Message-ID: <3F38B8CE.7090007@xtn.net> (raw)
In-Reply-To: <jphn.85s.17@gated-at.bofh.it>

Larry McVoy wrote:
> On Mon, Aug 11, 2003 at 01:53:17PM -0400, Jeff Garzik wrote:
> 
>>Larry McVoy wrote:
>>are function calls at a 10-nanosecond glance.  Also, having two styles 
>>of 'if' formatting in your example just screams "inconsistent" to me :)
> 
> 
> It is inconsistent, on purpose.  It's essentially like perl's
> 
> 	return unless pointer;
> 
> which is a oneliner, almost like an assert().
> 
> Maybe this will help: I insist on braces on anything with indentation so
> that I can scan them more quickly.  If I gave you a choice between
> 
> 	if (!pointer) {
> 		return (whatever);
> 	}
> 
> 	if (!pointer) return (whatever);
> 
> which one will you type more often?  I actually don't care which you use,
> I prefer the shorter one because I don't measure my self worth in lines 
> of code generated, I tend to favor lines of code deleted :)  But either
> one is fine, I tend to use the first one if it has been a problem area
> and I'm likely to come back and shove in some debugging.


I prefer keeping the conditional statement separate from the condition, but 
either way works.  One thing I've noticed though is that one line if statements 
are difficult to debug in a debugger because there is no way to tell by watching 
the current debug line whether the conditional statement was executed or not. 
For that reason I use a two line if.  Of course, rumor has it that real 
programmers don't use debuggers....  :)

I would rather use the extra lines for two line if statements, then make up for 
that used space by avoiding unnecessary braces.


       reply	other threads:[~2003-08-12  9:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <jnSd.6CM.1@gated-at.bofh.it>
     [not found] ` <jo20.6MB.31@gated-at.bofh.it>
     [not found]   ` <jouY.7jw.9@gated-at.bofh.it>
     [not found]     ` <jov3.7jw.37@gated-at.bofh.it>
     [not found]       ` <joEI.7s9.9@gated-at.bofh.it>
     [not found]         ` <joOj.7Aj.11@gated-at.bofh.it>
     [not found]           ` <jphi.85s.1@gated-at.bofh.it>
     [not found]             ` <jphn.85s.17@gated-at.bofh.it>
2003-08-12  9:52               ` Ed Cogburn [this message]
2003-08-11 15:59 [PATCH] CodingStyle fixes for drm_agpsupport davej
2003-08-11 16:40 ` Larry McVoy
2003-08-11 16:58   ` Jeff Garzik
2003-08-11 17:04     ` Larry McVoy
2003-08-11 17:15       ` Jeff Garzik
2003-08-11 17:23         ` Larry McVoy
2003-08-11 17:53           ` Jeff Garzik
2003-08-11 17:59             ` Larry McVoy
2003-08-11 18:11               ` Jeff Garzik
2003-08-12 10:00             ` Werner Almesberger
2003-08-13 19:44               ` Jamie Lokier
2003-08-14 14:21       ` Eli Carter
2003-08-14 14:47         ` Larry McVoy
2003-08-14 15:18           ` Eli Carter
2003-08-14 15:28             ` Larry McVoy
2003-08-14 19:01               ` Gene Heskett

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=3F38B8CE.7090007@xtn.net \
    --to=ecogburn@xtn.net \
    --cc=linux-kernel@vger.kernel.org \
    /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