Article View: comp.lang.c++.moderated
Article #67I don't believe it! Weird thing about Virtual tables
From: Rodrigo de Salvo Braz
Date: Mon, 15 Apr 1996 17:19
Date: Mon, 15 Apr 1996 17:19
31 lines
1560 bytes
1560 bytes
Debugging a project in Borland C++ 4.0, I noticed something
unexpected...
The virtual table of one of my classes (say, Dog) is initialized by
code!
It sounds ok at first, but since each module has its own initializing
code (for global variables and similar stuff), I have Dog's virtual
table initialized AFTER initializing code of modules located BEFORE
Dog's module in the Project definition. Since I have variables using
Dog in those earlier modules, I get a real crash!
So I have to worry about the modules definition order in the project
in order to have my program working properly, and that sounds really
odd!
Am doing any mistake on it? Is there any option preventing it? Why
doesn't the compiler create the virtual tables already initialized?
Cheers,
Rodrigo Braz
[ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
[ Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm ]
[ Moderation policy: http://www.connobj.com/cpp/guide.htm ]
[ Comments? mailto:c++-request@netlab.cs.rpi.edu ]
Technical Details
Message-ID:
<4ku0ee$hjj@netlab.cs.rpi.edu>Path:
arc1-ca.pugleaf.net!news.crd.ge.com!rebecca!rpi!not-for-mailShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.crd.ge.com!rebecca!rpi!not-for-mail From: braz@ime.usp.br (Rodrigo de Salvo Braz) Newsgroups: comp.lang.c++.moderated,comp.lang.c++ Subject: I don't believe it! Weird thing about Virtual tables Date: 15 Apr 1996 17:19:10 -0000 Organization: Zippo Sender: cppmods@netlab.cs.rpi.edu Approved: Dietmar.Kuehl@uni-konstanz.de Message-ID: <4ku0ee$hjj@netlab.cs.rpi.edu> NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Mon, 15 Apr 1996 15:29:33 GMT