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-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!d34g2000vbm.googlegroups.com!not-for-mail From: REH Newsgroups: comp.lang.ada Subject: Re: C++0x and Threads - a poor relation to Ada's tasking model? Date: Wed, 12 Aug 2009 14:15:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: <6d23274b-d649-4a83-a6f1-6d1e9c4c3998@d34g2000vbm.googlegroups.com> References: <7q2385104kihs87d79p8kfphuoki6r01vq@4ax.com> <7961a91c-a5af-40e2-bbc0-6bf69a98176d@z31g2000yqd.googlegroups.com> <362f621e-a01c-4772-ba02-4e18e9962188@j19g2000vbp.googlegroups.com> <128d63da-361f-4e33-be5e-e06bdc71e39f@r34g2000vba.googlegroups.com> NNTP-Posting-Host: 192.35.35.34 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1250111710 30680 127.0.0.1 (12 Aug 2009 21:15:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 12 Aug 2009 21:15:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d34g2000vbm.googlegroups.com; posting-host=192.35.35.34; posting-account=GwkXCgoAAABFSG45Q--uHVZG6zn6ec-e User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.1 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7706 Date: 2009-08-12T14:15:10-07:00 List-Id: On Aug 12, 4:41=A0pm, Robert A Duff wrote: > The philosophy has nothing to do with "explicitly". =A0And I don't > understand why you said "potential". =A0If you leave out those two words, > as in "you don't take a performance hit for exceptions or > range-checking, unless you use them," then I would agree with you 100%. > > The point is, if you use some feature X, you should not have > to pay the cost of feature Y that you do not use, just because > feature Y exists, and might have some interaction with feature > X in some other program that DOES use Y with X. > > C++ and Ada both share this philosophy. =A0It's called > "avoid distributed overhead". The reason I said "potentially" is you may or maybe pay the cost in Ada, depending on the implementation. There are implementations where you will always pay a speed penalty for exceptions (e.g., in setting up the frame), and there are ones where you only pay if an exception is raised (e.g., a table-based implementation). A C++ compiler will not make me "pay" the cost of exceptions if I never make use of them. What I mean by that is, if I don't have a try block, there will never be any setup code to catch or propagate exceptions. In Ada, you may or may not. Similarly with range-checking. If I index an array in Ada, it may or may not range check the index (a smart compiler can remove the check if it can prove it cannot be out-of-range). C++ will not range check the index. I have to do it explicitly (which is why I used that word), or if I am using vectors, call the at member explicitly. REH