lkml.org 
[lkml]   [2001]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [IDEA+RFC] Possible solution for min()/max() war
Date
"A month of sundays ago David Woodhouse wrote:"
> Code which relies on "if(0) __call_nonexistent_function();" actually compiling
> is just broken.

You got me curious enough to try it. It compiles and links fine with
-O1 and higher under

gcc version 2.95.2 20000220 (Debian GNU/Linux)
gcc version 2.8.1
gcc version 2.7.2.3

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

One CAN rely on this behaviour so long as branch reduction (well,
whatever it's called) is an optimizing step following constant
expression evaluation. The fn call will never make it outside of gcc's
internal repreentation.

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


Peter
-
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 13:01    [W:0.199 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site