lkml.org 
[lkml]   [2008]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/5 ver2] debug: BUILD_BUG_ON: error on non-const expressions
Rusty Russell wrote:
> On Wednesday 03 September 2008 01:57:31 Boaz Harrosh wrote:
>> +#define BUILD_BUG_ON(e) \
>> + do { struct {int:-!!(e); } x __maybe_unused;} while(0)
>
> Why did you hate the void cast again? Simplest should
> be "(void)BUILD_BUG_ON_ZERO(e)". But if not, it seems to me that it's
> cleaner to do:
>
> #define BUILD_BUG_ON(e) \
> do { } while(BUILD_BUG_ON_ZERO(e))
>

I have not checked this exact variant, but the problems I had
is that wrong or non-const code was ignored by the compiler,
which is what I tried to solve.

> No chance of the compiler emitting unused vars.
>

There is no unused vars because the result is a zero-sized
struct which will never emit any code.

> Cheers,
> Rusty.
>

Is it that important? the code submitted does what is required
to the letter, should we spend more effort on this?

Boaz



\
 
 \ /
  Last update: 2008-10-05 11:37    [W:0.078 / U:3.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site