lkml.org 
[lkml]   [2012]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] Documentation/CodingStyle: Mention multi-line macros using expressions
From
Date
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 \
})



\
 
 \ /
  Last update: 2012-07-11 20:41    [from the cache]
©2003-2011 Jasper Spaans