Re: [IDEA+RFC] Possible solution for min()/max() war

Andy Chou (acc@CS.Stanford.EDU)
Thu, 30 Aug 2001 19:34:49 -0700


How about:

#define AssertNow(x) switch(1) { case (x): case 0: }

as in:

AssertNow(sizeof(typeof(x)) == sizeof(typeof(y)));

I'm not sure if gcc optimizes this away, but it would be easy for someone
to find out.

I didn't invent this.

-Andy

> And I was hoping that somebody could produce some gcc magic
> replacement for BUG() that means "don't compile me". Perhaps
> a bit of illegal assembler code with a line reference in?
> Surely gcc must have something like __builtin_wont_compile()?
> It just needs to be a leaf of the RTL that evokes a compile error.

-
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/