template and preprocessor

D

David Lindauer

suppose I have this:

template <class T>
class myclass {
T a ;
#ifdef PREPROC_SYMBOL
T b;
#endif
} ;

at what point do the preprocessor statements get interpreted? When the
template is being compiled, or
when the template definition is being invoked?

Thanks,

David
 
?

=?ISO-8859-15?Q?Juli=E1n?= Albo

David said:
template <class T>
class myclass {
T a ;
#ifdef PREPROC_SYMBOL
T b;
#endif
} ;
at what point do the preprocessor statements get interpreted? When the
template is being compiled, or
when the template definition is being invoked?

The preprocessor, as his name says, is executed before compiling. In some
systems is executed as a separate program and his output is directed to the
"real" compiler. And even if the compiler does not work that way,
habitually a separate preprocessor is available just in case you need to
use it (cpp is a usual name for it).

Then, when the template is compiled, all preprocessing has been done before.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top