All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "Robert P. J. Day" <rpjday@crashcourse.ca>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Documentation/CodingStyle: Mention multi-line macros using expressions
Date: Wed, 11 Jul 2012 11:14:42 -0700	[thread overview]
Message-ID: <1342030482.22278.8.camel@joe2Laptop> (raw)
In-Reply-To: <alpine.DEB.2.02.1207111329280.3642@oneiric>

On Wed, 2012-07-11 at 13:32 -0400, Robert P. J. Day wrote:
[]
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
[]
> +A newer technique is to use the GCC extension of being able to place
> +statements and declarations in an expression, as with this example from
> +the <linux/kernel.h> header file:
> +
> +#define roundup(x, y) (				\
> +{						\
> +        const typeof(y) __y = y;		\
> +        (((x) + (__y - 1)) / __y) * __y;	\
> +}						\
> +)

Hi Robert.

How about the phrase "GCC's statement expression extension"
or maybe give a link like:
http://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html

Please put the opening ({ and closing )} on a single line.
It's shorter and makes grep easier.

#define statement_expression(args)		\
({						\
	etc					\
})



  reply	other threads:[~2012-07-11 18:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11 17:32 [PATCH] Documentation/CodingStyle: Mention multi-line macros using expressions Robert P. J. Day
2012-07-11 18:14 ` Joe Perches [this message]
2012-07-13 12:43   ` Robert P. J. Day

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=1342030482.22278.8.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpjday@crashcourse.ca \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.