From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1108a1,7a180be12347b9d3 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,7a180be12347b9d3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-18 11:45:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!pc2-clif3-0-cust11.not.cable.ntl.COM!not-for-mail From: brangdon@cix.co.uk (Dave Harris) Newsgroups: comp.lang.ada,comp.object Subject: Re: Merits of re-dispatching Date: Mon, 18 Feb 2002 19:47 +0000 (GMT Standard Time) Message-ID: References: <3c70b935.501062@News.CIS.DFN.DE> Reply-To: brangdon@cix.co.uk NNTP-Posting-Host: pc2-clif3-0-cust11.not.cable.ntl.com (80.4.39.11) X-Trace: fu-berlin.de 1014061525 2789901 80.4.39.11 (16 [57443]) Xref: archiver1.google.com comp.lang.ada:20111 comp.object:34624 Date: 2002-02-18T19:47:00+00:00 List-Id: dmitry@elros.cbb-automation.de (Dmitry A. Kazakov) wrote (abridged): > > This should produce B.Foo B.Foo A.Foo A.Foo. > > With my correction it will produce: > > B.Foo B.Foo B.Foo A.Foo. Right. So you see that Ada is different from C++, and your description of C++ in Ada terms gives the wrong results. You said earlier that: That is one of several possible interpretation of what happens in C++ using Ada terms. but the other interpretation you offered doesn't correspond to how C++ behaves. That was my only point, really. > Why on earth a call to Foo from B.Finalize should dispatch? The type > is known, so there is only one version of Foo to be called. Let's not muddle the issue with compiler optimisations. A C++ compiler is allowed to replace dynamic dispatch with static if it can deduce the dynamic type of the object at compile-time. Constructors are not a special case (although the deduction is unusually simple for them). All of this is under the "as if" rule. C++ must behave as if it dynamically dispatched in constructors. Dave Harris, Nottingham, UK | "Weave a circle round him thrice, brangdon@cix.co.uk | And close your eyes with holy dread, | For he on honey dew hath fed http://www.bhresearch.co.uk/ | And drunk the milk of Paradise."