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: a07f3367d7,9983e856ed268154 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.236.74.196 with SMTP id x44mr10951765yhd.38.1344998912418; Tue, 14 Aug 2012 19:48:32 -0700 (PDT) MIME-Version: 1.0 Path: c6ni111942101qas.0!nntp.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nrc-news.nrc.ca!goblin2!goblin.stu.neva.ru!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Should Inline be private in the private part of a package spec? Date: Thu, 9 Aug 2012 19:12:36 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <501bd285$0$6564$9b4e6d93@newsspool4.arcor-online.net> <613764f5-0216-4271-9278-70290198d71d@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1344557562 27032 69.95.181.76 (10 Aug 2012 00:12:42 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 10 Aug 2012 00:12:42 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Received-Bytes: 3261 Date: 2012-08-09T19:12:36-05:00 List-Id: "Shark8" wrote in message news:613764f5-0216-4271-9278-70290198d71d@googlegroups.com... > On Thursday, August 9, 2012 4:18:40 PM UTC-6, Randy Brukardt wrote: >> "Robert A Duff" wrote in message >> >> If 10.1.4(7/3) didn't exist, then Inline would not need to be given in >> visible spec. But as I noted elsewhere, I don't think Inline should be >> given >> anywhere -- compilers can figure out when to Inline better than any human >> can. Hints about the amount of space expansion allowed for the entire >> program and the relative importance of particular subprograms would be >> much >> more valuable. > > Well, isn't that the reason that Pragma Inline allows the compiler to > inline the > subprogram, rather than being a compiler switch _requiring_ the subprogram > to be inlined? Sure. But nothing prevents a compiler from inlining any subprogram it wants. And if it can, it ought to inline every subprogram that makes sense. So the only real advantages of Inline are (1) Adding a compilation dependence, which makes it easier to implement on most compilers; (2) Providing a rather non-specific hint that it might be a good idea to inline this subprogram. I'd rather have a more specific hint, and let the compiler decide how best to implement it. (And get rid of the compiler dependence -- nothing good comes out of extra dependences.) In particular, some subprogram might be best partially inlined (that is, substituting some but not all parameters in a duplicate of the subprogram). For example, imagine New_Line, where the second parameter is rarely used. And on some machines, a call is going to be no more expensive than the inlined code (in which case the call is preferred because it could decrease cache pressure). And so on... Randy.