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-7-bit X-Google-Thread: 103376,571930b4ff0bc1ee X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-04 00:58:03 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: Wed, 04 Apr 2001 09:47:35 +0200 Organization: MIDA Systemutveckling AB Message-ID: <3ACAD197.FB2C3303@mida.se> References: <3AC03CCE.70E3C2D5@mida.se> <3AC18DD1.EF25CE42@mida.se> <5mzw6.415$1H6.72722473@newssvr16.news.prodigy.com> <3AC2EB17.33AAEC0A@mida.se> NNTP-Posting-Host: sdu168-250.ppp.algonet.se Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: cubacola.tninet.se 986370456 11172 195.163.250.168 (4 Apr 2001 07:47:36 GMT) X-Complaints-To: abuse@algo.net NNTP-Posting-Date: 4 Apr 2001 07:47:36 GMT X-Mailer: Mozilla 4.6 [en] (WinNT; I) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:6436 Date: 2001-04-04T07:47:36+00:00 List-Id: Ken Garlington wrote: %< > : Say I want to create a table of data. The data is constant and must not > : change during the programs lifetime. Further more, the data is quite > : time consuming to calculate. > : > : In C++ (bad word again :) I can (with some effort) write a template that > : does all the calculations in the compiler at compile time. > > Could you post an example of such a template, and what in the C++ standard > you rely upon to guarantee compile-time calculations? Also, does > "compile-time" include "link-time", or are you not allowed to have anything > in the table that uses addresses? Well.. no. I must admit (quite embarresed) that I can't, I spent a few hours during the weekend trying to put together an example, but I couldn't get it to work. However (and more importantly) I've seen such a thing done, I just havn't acces to that sourcecode anymore, so I really can't examine it. Bugger, it might be that I'm plain wrong and have fallen for some 'good talk for the project management' (I'm NOT the manager, but...) > It's the part about "pasting the output" that seems odd. Why not have it > generate a stand-alone Ada *package* (e.g, BlahBlah)? We do this now in a > number of cases. In fact, you can have an automated build script that > generates the code, updates the CM system with it, then does the things you > usually expect in such a script (extract source from CM system, compile, > link...) Yes, I could, but: 1. I'm too lazy to do it. 2. There's quite a lot of other code/data in the package. But this actually gives me an idea, my data table could be separate, right ? That would render the output from the tool so small that I actually could generate the whole source file, so that no handediting is needed. I'll need to investigate this. > : Am I plain stupid since I worry about when what's included in my > : output and when time is consumed ? > > Not at all. However, the source generation option can be just as reliable > (more so, since it's less dependent on compiler-specific optimizations) that > whjat you are wanting, IMHO. Even better, you can readily reuse the concept > if you move between languages (just have the source generation tool use a > template file to control the form of the output). OK I thought that i had decided to let the tool produce an (ELF) object file and just pragma Import(..) a symbol from that. Now I'll investigate and reconsider. -- 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