[lkml]   [2003]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [Dri-devel] Re: [PATCH] CodingStyle fixes for drm_agpsupport
On Mon, Aug 11, 2003 at 01:21:22PM -0700, Sottek, Matthew J wrote:

> 2) There are some very real ways that bracketless code will
> get broken. Either someone adds a line that didn't notice the
> lack of brackets or, someone accidentally uses a multi-line
> macro.
> i.e.
> if(foo)
> DEBUG_PRINT("Foo!\n");
> works great for 100 years until someone recodes the DEBUG_PRINT
> macro to be 2 lines. The Linux kernel often has plain looking
> functions or variables that end up being macros (and may only
> expand to multi-line on some platforms) which could easily get
> you into such a situation.

#define DEBUG_PRINT(x) do { printk((x)); printk((x)); } while (0)

I believe your example is, oh, the #1 reason for this style of macro.


Ryan Anderson
sometimes Pug Majere
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:47    [W:0.059 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site