Messages in this thread | | | Date | Fri, 22 May 2009 06:26:52 +0100 | From | Al Viro <> | 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.
| |