[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1207130842530.27681@oneiric>
Date: Fri, 13 Jul 2012 08:43:51 -0400 (EDT)
From: "Robert P. J. Day" <rpjday@...shcourse.ca>
To: Joe Perches <joe@...ches.com>
cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Documentation/CodingStyle: Mention multi-line macros
using expressions
On Wed, 11 Jul 2012, Joe Perches wrote:
> 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
ok, i'll do that later today.
> Please put the opening ({ and closing )} on a single line.
> It's shorter and makes grep easier.
>
> #define statement_expression(args) \
> ({ \
> etc \
> })
i was simply transcribing what was in kernel.h verbatim, but i'll
tuck it together for brevity.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists