This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Templates problem
- To: gcc at gcc dot gnu dot org
- Subject: Templates problem
- From: Pascal Francq <pfrancq at ulb dot ac dot be>
- Date: Wed, 23 Feb 2000 14:15:51 +0100
- Organization: Université Libre de Bruxelles
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