Thread View: comp.std.c++
1 messages
1 total messages
Started by Harvey Rook
Fri, 06 Oct 1995 15:04
Templates and Undefined Functions.
Author: Harvey Rook
Date: Fri, 06 Oct 1995 15:04
Date: Fri, 06 Oct 1995 15:04
42 lines
1852 bytes
1852 bytes
I friend of mine ran into a rather odd situation today. We found the
solution, but now I'm trying to find out what the standard would says about
this
situation.
A long time ago we copied some code from a random library. Inside this code
was something similar to:
template <class t> class FooClass
{
public:
t *FooReturn()
{
return (t *)UndefinedFunc();
};
};
Unfortunatly we forgot to copy UndefinedFunc() and its prototype along with
the FooClass.
As chance would have it, we never created an instance of FooClass.
On compilers A and B, FooClass compiled fine. However compiler C complained
that FooClass called the undefined function, UndefinedFunc().
What does the standard say about templates and inline functions that are
never used? Do they have to contain completly valid code? Or can they be
ignored? Which compiler is right?
BTW, our solution to get the code to compile with compiler C was to simply
delete FooClass.
Harvey Rook
harveyr@linkage.com
"Any species that has the technology to destroy itsself, should." -Mike
Burns
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads