On Wed, 6 Sep 2000, Chris Wedgwood wrote:
> Oh, yes there is.
>
> if (CONFIG_FOO) {
> ....
> } else {
> ....
> }
>
> gcc can optimize that away and parser will see the whole thing.
>
> I'm not sure I like this construct either.
>
> Yes, it does mean gcc makes all the decisions and allows the
> c-compiler to to more checking (as opposed to the preprocessor which
> obviosly is really dumb) but it also assumes the compiler will always
> elimiate dead code and I'm not convinced it's any more readable that
> have "#if foo" scattered through the code.
If gcc will _ever_ fail to optimize away else in
if (1) {
...
} else {
...
}
- it's a bug in gcc. Sorry. Checking for the absence of code paths that would
lead into block in question is trivial. I suspect that if you can demonstrate
such example to gcc folks they will consider it as an obvious bug.
As readability - it's definitely at least as readable as
#if[def]. It also provides more consistent syntax. And when you are
using ifdef to violate scoping - your code is in need of rewrite anyway.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/
- Re: 2.4.0-test8-pre1 is q... Alexander Viro
- Re: 2.4.0-test8-pre1 ... Alexander Viro
- Re: 2.4.0-test8-pre1 ... Linus Torvalds
- if (CONFIG_FOO) Re: 2.4.0-test8-pre1 i... Martin MaD Douda
- Re: if (CONFIG_FOO) Re: 2.4.0-test... Alexander Viro
- Re: if (CONFIG_FOO) Re: 2.4.0-test... Russell King
- Re: 2.4.0-test8-pre1 is quite bad / ho... Peter Samuelson
- Re: 2.4.0-test8-pre1 is quite bad / how ab... Peter Rival
- Re: 2.4.0-test8-pre1 is quite bad / ho... Andi Kleen
- Re: 2.4.0-test8-pre1 is quite bad ... Mark H. Wood
- Re: 2.4.0-test8-pre1 is quite bad / how about i... Alexander Viro
- Re: 2.4.0-test8-pre1 is quite bad / how ab... Alan Cox
- Re: 2.4.0-test8-pre1 is quite bad / ho... Alexander Viro
- Re: 2.4.0-test8-pre1 is quite bad / how ab... Tim Waugh
- Re: 2.4.0-test8-pre1 is quite bad / how ab... Jamie Lokier
- Re: 2.4.0-test8-pre1 is quite bad / how about i... Michael Elizabeth Chastain
- Re: 2.4.0-test8-pre1 is quite bad / how ab... Alexander Viro
- Re: 2.4.0-test8-pre1 is quite bad / ho... Martin Dalecki
- Re: 2.4.0-test8-pre1 is quite bad ... Alexander Viro
- Re: 2.4.0-test8-pre1 is quite ... Martin Dalecki
- Re: 2.4.0-test8-pre1 is quite bad / how ab... Linus Torvalds

