lkml.org 
[lkml]   [2008]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/5] debug: BUILD_BUG_ON: error on non-const expressions
>>> Boaz Harrosh <bharrosh@panasas.com> 01.09.08 17:00 >>>
>What is broken with my BUILD_BUG_ON_ZERO(). I tried all tests and
>it works fine. Do you have a test with unwanted results?
>(Actually it's the original one I have not touched it).

That's the problem - it uses the same sizeof(char[]) approach, and hence
has the same problems that you just try to fix for BUILD_BUG_ON().

>>>> Of course you could wrap the whole thing in ({}),
>>> "do{}while(0)" is effectively an "{}" plus the added bonus
>>> of demanding an ";" ;-)
>>
>> An expression likewise demands a terminating ; (or a continuation of the
>> expression, i.e. by using an operator)
>>
>
>I was not criticizing your approach, I was commenting on:
>"{}" vs. do{}while(0)

I think we're having some mis-understanding here: What I'm concerned
about is that you can't use statements where-ever expressions can be
used (the opposite is true, because expressions are statements). My
main concern is the limitation of its use inside macros, where one could
try to use comma expressions to combine multiple BUILD_BUG_ON()-s.

Jan



\
 
 \ /
  Last update: 2008-09-01 17:31    [W:3.972 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site