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,2a34b7ad6c6a0774 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Efficiency of code generated by Ada compilers Date: Tue, 10 Aug 2010 14:32:50 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <8349c981-4dca-49dc-9189-8ea726234de3@f42g2000yqn.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: pcls6.std.com 1281465153 13748 192.74.137.71 (10 Aug 2010 18:32:33 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 10 Aug 2010 18:32:33 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:muu1dvYERVM2mShRRxgUpNFcrpU= Xref: g2news1.google.com comp.lang.ada:13083 Date: 2010-08-10T14:32:50-04:00 List-Id: "Yannick Duch�ne (Hibou57)" writes: > Le Tue, 10 Aug 2010 17:01:10 +0200, Robert A Duff > a �crit: >> No, Ada generics work the same way as C++ templates -- the typical >> implementation is that each instance gets a separate copy of >> the code > I wonder If I've understood you correctly. It seems Ada use code sharing > (which is the reason of some restriction on formal parameters). Code > duplication is the C++'s template way, not the Ada's generic package > way. Or am I mistaken somewhere ? Most Ada compilers, including GNAT, use code duplication. Some Ada compilers support code-sharing for instance bodies, either in some cases, or in all cases. I don't know of any C++ compilers that support sharing of template instances. Code sharing is hard in Ada. It is substantially harder in C++, I think. But note that I am not a C++ compiler expert! - Bob