Re: [Infiniband-general] Getting an Infiniband access layer intheLinux kernel

From: Måns Rullgård
Date: Fri Feb 06 2004 - 13:14:36 EST


"Richard B. Johnson" <root@xxxxxxxxxxxxxxxxxx> writes:

> On Fri, 6 Feb 2004, Roland Dreier wrote:
>
>> Richard> If some major changes are being considered, I think it's
>> Richard> time to get rid of the:
>>
>> Richard> do { } while(0) stuff that permiates a lot of MACROS and
>> Richard> just use the { } as they were designed.
>>
>> Richard> Before everybody screams, think. It's perfectly correct
>> Richard> to start a new "program unit" without a conditional
>> Richard> expression. You just add a curley-brace, then close the
>> Richard> brace when you are though.
>>
>> This is totally, totally wrong. If you get rid of do { } while (0),
>> then you can't use the macro in an if statement. Read any C FAQ for
>> details, or try the following:
>>
>
> Yes you can. You just don't use an ';' if you are going
> to use 'else'.

Now suppose someone changes the macro into an inline function. Then
the ; is suddenly required. How are you going to deal with that?

--
Måns Rullgård
mru@xxxxxx

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