This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization and template parms
- To: Andrew Borthwick <borthwic at johnson dot cs dot nyu dot edu>
- Subject: Re: Optimization and template parms
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 02 Feb 1998 14:31:31 -0700
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <Pine.GSO.3.92.980202142024.10958D-100000@johnson.cs.nyu.edu>you w
rite:
> Hi,
>
> In the following method of a templated class:
>
> template <bool c>
> Foo<c>::f1() {
> if (c) {cout << "true" << endl;}
> else {cout << "false" << endl;}
> }
>
> Would I be correct to assume that after instantiating the template,
> egcs wouldn't emit any code for the if/else test because the test always
> succeeds for Foo<true> and fails for Foo<false>?
That would be my expectation. But I don't know enough about C++ to know how
it will look in RTL when the optimizers get their first crack at removing the
unreachable code.
jeff