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!postnews.google.com!l41g2000cwc.googlegroups.com!not-for-mail From: "Jerry Coffin" Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Date: 8 Mar 2005 18:43:05 -0800 Organization: http://groups.google.com Message-ID: <1110336185.044049.21920@l41g2000cwc.googlegroups.com> 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> NNTP-Posting-Host: 70.33.25.135 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1110336189 3879 127.0.0.1 (9 Mar 2005 02:43:09 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 9 Mar 2005 02:43:09 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: l41g2000cwc.googlegroups.com; posting-host=70.33.25.135; posting-account=mZiOqwwAAAC5YZsJDHJLeReHGPXV5ENp Xref: g2news1.google.com comp.lang.ada:8903 comp.lang.c++:44692 comp.realtime:1096 comp.software-eng:4653 Date: 2005-03-08T18:43:05-08:00 List-Id: Dr. Adrian Wrigley wrote: [ ... ] > Isn't there some confusion here? > > Surely the "aliasing" issue (ignored by C++ completely(?)) is largely > independent if the "reinterpret_cast"/"Unchecked_Conversion" issue? Yes -- he started by mentioning aliasing, but mostly seemed to be talking about type punning, so that was what I replied to. The discussion centered around safety, which is essentially orthogonal to aliasing. > The C++ programmer uses aliasing routinely and without thinking. Aliasing is used frequently in C++, that much is true. IMO, the claim that it's done "without thinking" is nothing more or less than flame bait. I think you're capable of better. > Ada makes the aliasing possibility explicit when necessary, but > prohibits it otherwise. Aliasing is almost certainly more common in C++, but ultimately it only ever happens explicitly in either language. In fact, I think "explicit" is virtually meaningless in discussing a programming language -- the processor is not an intelligent being that makes decisions on its own unless explicitly directed. As such, nothing in code is really implicit. What most people call "implicit" is simply the rules of the language doing their job. Even those who push explicitness as a virtue rarely do things like parenthesizing a+(b*c). Even those who argue most strongly for explicitness generally agree that this would be silly, at least in "obvious" cases like the one above. The "implicit" behavior I've seen Ada programmers complain about in C++ is equally codified in the rules of the language, and the fact that Ada programmers think it's somehow implicit mostly just reflects the fact that they don't know those rules. That's fine, but condemning the language simply because they don't know it is much less so. > If we're talking about the "reinterpret_cast" issue, it is > essentially identical in Ada. ...and this is what actually affects safety. Aliasing mostly just makes it more difficult to generate efficient code. Despite this, most claims that C and/or C++ produce particularly poor code show little more than defects in the testing. -- Later, Jerry. The universe is a figment of its own imagination.