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=-0.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e93f73587e2bc1c3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!193.201.147.84.MISMATCH!xlned.com!feeder1.xlned.com!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!news.ett.com.ua!not-for-mail From: anon@att.net Newsgroups: comp.lang.ada Subject: Re: Sharing generic bodies across instantiations. Date: Tue, 27 Jul 2010 20:06:44 +0000 (UTC) Organization: ETT newsserver Message-ID: References: <4c4e2d69$0$2378$4d3efbfe@news.sover.net> Reply-To: anon@anon.org NNTP-Posting-Host: dialup-4.225.169.0.dial1.dallas1.level3.net X-Complaints-To: usenet@news.ett.com.ua X-Notice: Filtered by postfilter v. 0.6.1 X-Newsreader: IBM NewsReader/2 2.0 Xref: g2news1.google.com comp.lang.ada:12616 Date: 2010-07-27T20:06:44+00:00 List-Id: In <4c4e2d69$0$2378$4d3efbfe@news.sover.net>, "Peter C. Chapin" writes: >It has been my understanding that Ada's generics are designed in such a >way as to allow implementations to share the code of a generic body >across all the instantiations. I understand that doing this might >involve a performance penalty relative to creating independent code for >each instantiation. However, I can see that there are cases where such >sharing would be desirable. > >Is my understanding still accurate (was it ever accurate), for example >even with Ada 2005? > >Thanks! > >Peter The Replication versus the Sharing of Generic code was initial based on the Ada Optimize pragma statement. That is, when the users define the option of "Time" the Generic code would be replicated, but the "Space" option would cause the compiler to share the code body. Not using the pragma statement or the Ada 95 "off" option allowed the designer to set an implementation default. Now as for GNAT it uses the optimization based on the GCC back end ( -OX where X in 0 .. 4 ). GNAT still preforms a syntactical check of the Optimize pragma statement, then treat's the statement as a comment like a number of other built-in Ada pragma statement. Which allows GNAT to replicate code and let the GCC handle rather its switches to shared or not. And at this time GCC does not understand the Ada's concept replication versus the sharing code for optimization.