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 X-Google-Thread: 103376,571930b4ff0bc1ee X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-05 00:12:05 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!skynet.be!news.algonet.se!algonet!pepsi.tninet.se!not-for-mail From: Mats Karlssohn Newsgroups: comp.lang.ada Subject: Re: Compile time executed functions Date: Thu, 05 Apr 2001 09:06:45 +0200 Organization: MIDA Systemutveckling AB Message-ID: <3ACC1985.7CB6D9E8@mida.se> References: <3AC03CCE.70E3C2D5@mida.se> <3AC192D0.B1E48088@mida.se> <3AC2F5B6.AB04D238@mida.se> NNTP-Posting-Host: du166-155.ppp.algonet.se Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: zingo.tninet.se 986454420 5292 195.100.155.166 (5 Apr 2001 07:07:00 GMT) X-Complaints-To: abuse@algo.net NNTP-Posting-Date: 5 Apr 2001 07:07:00 GMT X-Mailer: Mozilla 4.6 [en] (WinNT; I) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:6497 Date: 2001-04-05T07:07:00+00:00 List-Id: Robert A Duff wrote: > > Mats Karlssohn writes: > > > Maybe you could see my proposed pragma as a representation pragma > > for code then ? > > OK, but only as a hint. Rep pragmas or clauses for data can be tested, > because you can Unchecked_Convert the data, and see if it's represented > the way you asked. But how do you test a rep pragma for code? For > example, how can you write an Ada program that behaves differently > depending on whether pragma Inline was obeyed? No fair looking at the > generated code. How to check it... there should't be more than initialize data left at the place the function was called and since the function is not (at least in my case) called from anywhee else the body shoule _not_ be included in the output. When writing the previous sentence I really felt thah my english isn't what it needs to be to discuss really complicated matters, so maybe I didn't understand your point ? As for the test for inlined code... hmmm, I guess it'd be kind of hard. > > This leads me to another thing that I've sometimes have found annoy�ng: > > Why isn't it required by the language that there should be a n option > > to force the compiler to tell you wich pragma;s it cant obey ? > > I just hate auditing machine code just to check that the compiler > > hasn't generated silly code. Although I must admit that this stuff has > > only occured a few times during the past 7 years. > > But how would you know if *that* option were obeyed? Suppose the > compiler says "yes, I inlined your function", how do you know if it's > lying? You still have to inspect the generated code. Well, until proven otherwise I trust the compiler vendor (a trust that have proven false quite often), so if such an option was availible I'd trust it (on my own projects, clients may have other ideas) until I suspect that it lies, then som investigation is needed. > In practise, though, compilers do give this kind of information. > Eg, the documentation will normally tell you "we obey pragma Inline in > the following circumstances...". Yes, aside from it beeing inconvenient to have to look for such things in the documentation, I have found that the documentation is often buried in some archive somwhere or just missing :( -- Mats Karlssohn, developer mailto:mats@mida.se Mida Systemutveckling AB http://www.mida.se Box 64, S-732 22 ARBOGA, SWEDEN Phone: +46-(0)589-89808 Fax: +46-(0)589-89809