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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-16 18:25:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!wn14feed!worldnet.att.net!199.45.49.37!cyclone1.gnilink.net!spamkiller2.gnilink.net!nwrdny03.gnilink.net.POSTED!53ab2750!not-for-mail From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030901 Thunderbird/0.2 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? References: <568ede3c.0309160929.1d0d3d95@posting.google.com> <3F67AFB9.7040001@attbi.com> In-Reply-To: <3F67AFB9.7040001@attbi.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 17 Sep 2003 01:25:02 GMT NNTP-Posting-Host: 162.84.176.54 X-Complaints-To: abuse@verizon.net X-Trace: nwrdny03.gnilink.net 1063761902 162.84.176.54 (Tue, 16 Sep 2003 21:25:02 EDT) NNTP-Posting-Date: Tue, 16 Sep 2003 21:25:02 EDT Xref: archiver1.google.com comp.lang.ada:42592 Date: 2003-09-17T01:25:02+00:00 List-Id: Robert I. Eachus wrote: > But as for your assertion above, I had to laugh. OK. Are you done now? > If you want you can try to shoot yourself in the foot that way in Ada. There is no foot shooting involved here, in either C++ or Ada. > If the compiler can't tell at compile time that a particular cast will > always succeed (or always fail) it will put code in to check and raise > an exception for the type conversion. As will the dynamic_cast in C++. > there is no reason to do explicit casting Except when there is. These kinds of situations arise when objects are held in containers, passed around through various pieces of code not necessarily under your control, and finally handed back to your code. The object comes in as a pointer to some class, and the situation may arise when you need to know whether the object is of some other class type as well. The dynamic_cast will safely tell you, (almost) regardless of how the two classes are arranged in the inheritance hierarchy of the most derived type. This is a moot point in Ada right now, since Ada just has SI. When the access discriminant style is used, this cross-casting is impossible unless you go back to the base type first, which means that code which in C++ would know only about the two interface types must in Ada be aware of the containing type as well.