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

David Woodhouse (dwmw2@infradead.org)
Thu, 30 Aug 2001 22:47:49 +0100


ptb@it.uc3m.es said:
> Now I think of it, I suppose
> unsafe_min_or_max_at_line_##__LINE__()
> will definitely evoke a meaningful link error.

Unfortunately, there's no guarantee that it won't emit a reference to that
symbol even if the test for mismatching arguments can be proved at compile
time to always evaluate to false.

Code which relies on "if(0) __call_nonexistent_function();" actually compiling
is just broken.

You'd have thought we'd have learned by now to stop relying on the observed
current behaviour of gcc and start trying to get it right, wouldn't you?

The answer in this case is that gcc can't safely do what we require for this
and for other compile-time checks, until something like David's
__builtin_ct_assertion() is added.

--
dwmw2

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