-----BEGIN PGP SIGNED MESSAGE-----
Hello,
I hope someone can tell me why the following source produces an error (trapno 14, error 5):
------------------------------------ class BaseClass { public: virtual void print() { printf("BaseClass::print()\n"); }; };
class DerivedClass : public BaseClass { public: virtual void print() { printf("DerivedClass::print()\n"); }; };
DerivedClass dc;
void main(void) { BaseClass *bc = &dc;
bc->print(); } ----------------------
If dc is defined inside main(), everything works fine.
Chris -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Christian Stueble............stueble@ls6.cs.uni-dortmund.de PubKey[BF7104F5].......fp=8678C5D3CAD9CD8C F1DDB8EC202F116A
To be or not to be is true... (apocrypha of George Boole) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Christian Stueble stueble@amaunet.cs.uni-dortmund.de:
I hope someone can tell me why the following source produces an error (trapno 14, error 5):
If dc is defined inside main(), everything works fine.
It's probably because you have a broken compiler/linker, or are using the wrong options to your compiler/linker. The code works for me. However, I have at times experienced global objects not being initialised, and I have even resorted to replacing "Object x;" by "Object *x = 0;" and preceding each use of x by "if (!x) x = new Object;" ... until I found out how to repair the link line.
This is off-topic for l4-hackers, by the way. I suggest we don't discuss this further on the list ...
Edmund
l4-hackers@os.inf.tu-dresden.de