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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!news.glorb.com!news-out.ntli.net!newsrout1-gui.ntli.net!ntli.net!newsfe1-gui.ntli.net.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <87is4598pm.fsf@insalien.org> <1110054476.533590@athnrd02> <1110059861.560004@athnrd02> <87wtsl7jts.fsf@insalien.org> <1110264816.858853.54020@l41g2000cwc.googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Tue, 08 Mar 2005 11:47:47 GMT NNTP-Posting-Host: 81.100.88.147 X-Complaints-To: http://www.ntlworld.com/netreport X-Trace: newsfe1-gui.ntli.net 1110282467 81.100.88.147 (Tue, 08 Mar 2005 11:47:47 GMT) NNTP-Posting-Date: Tue, 08 Mar 2005 11:47:47 GMT Organization: ntl Cablemodem News Service Xref: g2news1.google.com comp.lang.ada:8848 comp.lang.c++:44591 comp.realtime:1057 comp.software-eng:4609 Date: 2005-03-08T11:47:47+00:00 List-Id: On Mon, 07 Mar 2005 22:53:36 -0800, Jerry Coffin wrote: > Ludovic Brenta wrote: >> Here, Ada makes it explicit that unsafe programming is taking place. >> First, Obj must be declared as "aliased", which means that two or >> more paths can access it. In our case, Obj and Obj_As_String are >> the two paths. This is another of Ada's nice safety-related >> features. Since aliasing must be made explicit, the reader of the >> program knows up front whether or not aliasing takes place. The >> reader of a C++ program has no such knowledge. > > Nonsense -- in C++ you use a reinterpret_cast, which is equally > explicit about what's being done. If somebody reading C++ doesn't > recognize what a reinterpret_cast means, then he simply doesn't know > C++. > >> Also, the writer of the program must >> think twice, and understand the consequences if they make an object >> aliased. > > Anybody who uses a reinterpet_cast without a second (and third) thought > simply isn't a programmer, and of he wrote Ada instead, it'd still be > garbage. Isn't there some confusion here? Surely the "aliasing" issue (ignored by C++ completely(?)) is largely independent if the "reinterpret_cast"/"Unchecked_Conversion" issue? The C++ programmer uses aliasing routinely and without thinking. Ada makes the aliasing possibility explicit when necessary, but prohibits it otherwise. If we're talking about the "reinterpret_cast" issue, it is essentially identical in Ada. -- Adrian