Path: utzoo!attcan!uunet!image.soe.clarkson.edu!news From: cline@cheetah.ece.clarkson.edu (Marshall Cline) Newsgroups: comp.lang.c++ Subject: Re: Turbo-C++ problem when compiling without debugging info Message-ID: Date: 13 Aug 90 16:20:52 GMT References: <14509@shlump.nac.dec.com> Sender: news@sun.soe.clarkson.edu Reply-To: cline@sun.soe.clarkson.edu (Marshall Cline) Organization: (I don't speak for the) ECE Dept, Clarkson Univ, Potsdam, NY Lines: 58 In-reply-to: wallis@labc.enet.dec.com's message of 12 Aug 90 21:28:24 GMT In article <14509@shlump.nac.dec.com> wallis@labc.enet.dec.com (Barry L. Wallis) writes: > >The attached program exhibits some strange behavior. When compiled and linked >with debugging information turned on (both in the IDE or on the command line) >the prgram works fine. However, when the debugging information is turned off >(-v- on the command line). Needless to say this makes debugging very difficult > >The classes #included using qutoation marks are from the Turbo-C++ class >library. The others are the normal Turbo-C++ header files. > >Any ideas? In my TC++ review in the most recent `C++ Report' (vol.2, #7, Jul/Aug 90), I reported finding a very unusual compiler bug which behaved like this. If you call a virtual member function from an *inline* function in a base class, the virtual function call gets bound *statically*. Ex: class Stack { public: virtual int length() const = 0; // Return Stack's curr `length' int empty() const { return length() == 0; } // Is it empty? //... }; Under the following rather special conditions, TC++ generates bad code: IF * you compile it with command-line `tcc' rather than integrated `tc'. AND * you compile it with debugging turned off (-v-) AND * you compile it with inlines turned on (-vi) The work-arounds for this are obvious. Any one of the following will do: * out-line the `Stack::empty()' function OR * use `tc' (strange, but `tc' compiles it correctly) OR * use `tcc' but use -v (-v turns off inlining unless followed by -vi) OR * use `tcc' but use -vi- Borland has been made aware of the bug. Marshall Cline PS: I have created a bug-list repository for TC++ which has work-arounds. It's available by anonymous ftp from sun.soe.clarkson.edu [128.153.12.3] in the file ~ftp/pub/Turbo-C++/bug-report If you don't have ftp access, write me at my USmail address below, and I'll USmail it to you for a $5 processing fee (sorry for the fee, but I don't want to be inundated with requests that will cost me hours of my time :-). -- ============================================================================== Marshall Cline / Asst.Prof / ECE Dept / Clarkson Univ / Potsdam, NY 13676 cline@sun.soe.clarkson.edu / Bitnet:BH0W@CLUTX / uunet!clutx.clarkson.edu!bh0w Voice: 315-268-3868 / Secretary: 315-268-6511 / FAX: 315-268-7600 Career search in progress; ECE faculty; research oriented; will send vita. PS: If your company is interested in on-site C++/OOD training, drop me a line! ==============================================================================