Xref: utzoo comp.object:2427 comp.lang.pascal:5236 Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!bellcore!bytor From: bytor@ctt.bellcore.com (Ross Huitt) Newsgroups: comp.object,comp.lang.pascal Subject: Re: Shouldn't debuggers be able to debug dynamic objects? Message-ID: <1991Jan25.145947.16431@bellcore.bellcore.com> Date: 25 Jan 91 14:59:47 GMT References: <1991Jan24.152256.24273@resam.dk> Sender: usenet@bellcore.bellcore.com (Poster of News) Followup-To: comp.object,comp.lang.pascal Distribution: comp Organization: Computer Technology Transfer, Bellcore Lines: 31 In article <1991Jan24.152256.24273@resam.dk> andrew@resam.dk (Leif Andrew Rump) writes: >I experienced a rather annoying feature in TurboPascal 5.5 (but I >think the problem may exist in a lot of other (integrated) debuggers >used to debug object oriented programmes. >The program enclosed create two (2) dynamic objects: a square & a >box. >The first thing to notice is that the compiler only allow squareptr >to be used as a general object for squares & boxes! Well I could >accept that _IF_ the debugger (integrated & external (TD)) at least >would notice when I create a box! But no - it only display the >content of a square - the length has to be extracted manually!!! > ...code deleted > >Leif Andrew Rump, AmbraSoft A/S, Stroedamvej 50, DK-2100 Copenhagen OE, Denmark >UUCP: andrew@ambra.dk, phone: +45 39 27 11 77 / >Currently at Scandinavian Airline Systems =======/ >UUCP: andrew@resam.dk, phone: +45 32 32 51 54 \ >SAS, RESAM Project Office, CPHML-V, P.O.BOX 150, DK-2770 Kastrup, Denmark > >> > Read oe as: o / (slash) and OE as O / (slash) < < When I _know_ which derived class a base class ptr is pointing to and I want to inspect or display the object as a derived class, a cast is usually sufficient to get the job done. With the Turbo products, simply type in 'squareptr(general_object(1))' at the Display or Evaluate prompts. I don't know for sure that the technique works with Turbo Pascal or if this particular syntax is correct, but I do use the technique with C++ frequently. -ross aka bytor@ctt.bellcore.com