This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Optimization and template parms



  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]