lkml.org 
[lkml]   [2004]   [Feb]   [6]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
 
Messages in this thread
/
From(Måns_Rullgård)
SubjectRe: [Infiniband-general] Getting an Infiniband access layer in theLinux kernel
DateFri, 06 Feb 2004 19:12:28 +0100
"Richard B. Johnson" <root@chaos.analogic.com> 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@kth.se

-
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 14:00    [from the cache]
©2003-2008