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]

Templates problem


I define a template with two files ".h" for the declaration and ".hh" (include
in ".h") for the definition (see below).
I seems that the compiler (gcc 2.95.2) have problems with generating correct
code and debug information. For example in the init function, also if nb is
different than null, the program doesn't run the for loop.
It is possible? Perhaps is the way I manage the files for the templates is
wrong?



// foo.h
template<class T> : class foo
{
  T **tab;
  unsigned int nb;
...
  void init(void);
}

#include "foo.h"


//foo.hh
....
template<class T> void foo<T>::init(void)
{
  T **ptr;
  unsigned i;

  for(i=nb+1,ptr=Tab;--i;ptr++)
  {
    (*ptr)->doSomething1();
    (*ptr)->doSomething2();
  }
}

-- 


Ir. Pascal Francq
Researcher
Université Libre de Bruxelles
Faculty of Applied Mechanics
Avenue F.D. Roosevelt, 50
CP 165/41
B-1050 Brussels
BELGIUM
Tel. +32-2-650 47 65
Fax +32-2-650 27 10

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