[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090522052652.GX8633@ZenIV.linux.org.uk>
Date: Fri, 22 May 2009 06:26:52 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Joe Perches <joe@...ches.com>
Cc: linux-kernel@...r.kernel.org, cpufreq@...r.kernel.org,
Dave Jones <davej@...hat.com>,
Greg Kroah-Hartman <gregkh@...e.de>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
x86@...nel.org, Len Brown <len.brown@...el.com>,
Mike Travis <travis@....com>,
Rusty Russell <rusty@...tcorp.com.au>,
Thomas Gleixner <tglx@...utronix.de>,
Venkatesh Pallipadi <venkatesh.pallipadi@...el.com>,
Alan Cox <alan@...rguk.ukuu.org.uk>
Subject: Re: [PATCH V2 0/3] Introduce and use DO_ONCE statement expression
macro
On Thu, May 21, 2009 at 09:27:29PM -0700, Joe Perches wrote:
> The printk_once macro in kernel.h is limited to printk
>
> This generalizes the functionality of printk_once and
> allows statements like DO_ONCE(pr_info("foo\n"))
> and DO_ONCE(initialize(foo));
Sigh... Please, don't do introduce new control structures without extremely
good reasons.
printk_once() has syntax of function call; it's far more tolerable for
casual reader (e.g. somebody looking through the code while trying to
localize a bug) since it doesn't interrupt the flow - it parses as
"some function call, apparently doing some debugging output, let's see
if there are any obvious side effects in the arguments and move on".
Your DO_ONCE(....) parses as "what the fuck is that?" followed by
grepping for definition, and the cost is much higher.
Don't do that. Staying close to normal syntax is a very good thing;
preprocessor can be used in a lot of ways that are harmful and introduction
of (effectively) new kinds of statements is a prime example. It *does*
have its place, but it should be done very sparingly.
--
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