lkml.org 
[lkml]   [2003]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] parallel port

On Sun, 23 Mar 2003, Adrian Bunk wrote:
> >
> > for me. I think I complained about that once before already. Tssk, tssk.
>
> It's perhaps a silly question:
> Why did you use a "do ... while (0)" in your fix?

I always do that (well, almost always), just because it protects macros
from being mis-used.

For example, if you have

#define macro(x) ((x) = 3)

that _looks_ safe, but it allows people to write

x++ = macro(x);

or similar nonsense. So if you want a macro that always behaves like a
statement (and can't be used as an expression), the "do { } while (0)"
will do that.

[ The real answer is that it's so built in to my spine, that I just can't
stop myself. Even if it doesn't really matter. ]

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

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