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,154942e4f1d1b8e9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news-xfer.newsread.com!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.de!t-online.de!130.59.10.21.MISMATCH!kanaga.switch.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!cern.ch!news From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Dynamically tagged expression required Date: Wed, 14 Dec 2005 11:22:00 +0100 Organization: CERN - European Laboratory for Particle Physics Message-ID: References: <2852224.m2vuDFxfOX@linux1.krischik.com> <4718553.l2jsoQ7pK7@linux1.krischik.com> <49330337.ekYkZUKDL9@linux1.krischik.com> NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sunnews.cern.ch 1134555720 15209 (None) 137.138.37.241 X-Complaints-To: news@sunnews.cern.ch User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Red Hat/1.7.12-1.1.3.2.SL3 X-Accept-Language: en-us, en In-Reply-To: <49330337.ekYkZUKDL9@linux1.krischik.com> Xref: g2news1.google.com comp.lang.ada:6879 Date: 2005-12-14T11:22:00+01:00 List-Id: Martin Krischik wrote: >>>Yes. But it only look like the parameter is initialized. Internally the >>>compiler likely to use a pointer to pass the paramer to speed up things. > >>I don't care. :) >>I don't want to call something a "pointer" when it isn't in my program. > > I don't care either. But we at c.l.a had to repeat the << "in" is not slower > then "access" >> mantra so often that we just say it automatily now ;-) . OK, I see. I think it's "normal" in some way - we (on other forums) are busy breaking myths about C++ as well. ;) As for your mantra - depending on how compiler does its job, "in" might be actually *faster* than "access" for the following reason: "access" might imply indirection, whereas "in" might be just another (although const) name for the actual parameter, especially when the compiler inlines the whole call. I don't see anything that would forbid this and therefore I wouldn't be surprised to see such "inverse" effects in performance measurements. Is this reasoning correct for Ada? Of course, it is good to follow some coding "wisdom" in order not to make things worse or more difficult for the compiler, but AARM specifically says that tagged types are passed by reference (6.2). This means that passing objects by access variable *only* with hope to get better performance would be a premature optimization here (and the root of all evil). -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/