Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Accelerate blocks sorting
Date: Mon, 22 Jun 2009 19:26:00 -0000	[thread overview]
Message-ID: <m3d48wnk7m.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20090622183526.GA31281@host0.dyn.jankratochvil.net> (Jan Kratochvil's message of "Mon\, 22 Jun 2009 20\:35\:26 +0200")

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> +  return (BLOCK_START (b) > BLOCK_START (a))
Jan> +	 - (BLOCK_START (b) < BLOCK_START (a));

Tom> This expression needs parens around it, according to GNU rules.

Jan> GNU Coding Standards provides this sample code line:
Jan>          return ++x + bar ();

Jan> Moreover it has no sample code (and found no rules) with `return'
Jan> using parens.  GDB uses `return' with parens a lot but I find it
Jan> a GNU style violation by GDB fixing it along in the patches.

Jan> Sure no problem to change it but is there any backing for such parens?

Yeah.  It isn't the return, but the splitting.
From (info "(standards) Formatting") :

       Insert extra parentheses so that Emacs will indent the code properly.
    For example, the following indentation looks nice if you do it by hand,

         v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
             + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;

    but Emacs would alter it.  Adding a set of parentheses produces
    something that looks equally nice, and which Emacs will preserve:

         v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
              + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000);

And, yes, the GNU style is partly defined as "make it work nicely in
Emacs".

Tom> I think you don't actually need a cleanup here, as nothing here can
Tom> call error.  However, if you want to leave it, that is also ok with
Tom> me.

Jan> I did not notice, still I find the code safer that way.

Sounds good.

Tom


  reply	other threads:[~2009-06-22 19:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-22 17:39 Jan Kratochvil
2009-06-22 18:15 ` Michael Snyder
2009-06-22 18:26   ` Jan Kratochvil
2009-06-22 18:26 ` Tom Tromey
2009-06-22 18:35   ` Jan Kratochvil
2009-06-22 19:26     ` Tom Tromey [this message]
2009-06-22 19:51       ` Jan Kratochvil

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=m3d48wnk7m.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /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