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/
This archive was generated by hypermail 2b29 : Sun Mar 23 2003 - 22:00:44 EST