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.6 required=5.0 tests=BAYES_00,FROM_WORDY autolearn=no 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-03-29 06:30:05 PST Path: supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!news.stealth.net!newscon02.news.prodigy.com!newscon01.news.prodigy.com!prodigy.com!newsmst01!postmaster.news.prodigy.com!newssvr16.news.prodigy.com.POSTED!not-for-mail From: "Ken Garlington" Newsgroups: comp.lang.ada References: <3AC03CCE.70E3C2D5@mida.se> <3AC18DD1.EF25CE42@mida.se> <5mzw6.415$1H6.72722473@newssvr16.news.prodigy.com> <3AC2EB17.33AAEC0A@mida.se> Subject: Re: Compile time executed functions Organization: ex-FlashNet, now Prodigy X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: NNTP-Posting-Host: 65.65.210.233 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr16.news.prodigy.com 985876113 6207069 65.65.210.233 (Thu, 29 Mar 2001 09:28:33 EST) NNTP-Posting-Date: Thu, 29 Mar 2001 09:28:33 EST Date: Thu, 29 Mar 2001 14:28:33 GMT Xref: supernews.google.com comp.lang.ada:6205 Date: 2001-03-29T14:28:33+00:00 List-Id: "Mats Karlssohn" wrote in message news:3AC2EB17.33AAEC0A@mida.se... : Ken Garlington wrote: : %< : > : The other issue is that I feel that within Ada's expressive powers : > : it would be useful to have _some_ of the possibilities that is : > : availible when using C++ templates and/or C preprocessor macros. : > : (Please, no flames on the two 'bad words' above!) : > : > Is this a different subject than resolving complex functions as simple ROM : > constants? I'm having trouble seeing how a complex function written as a : > macro consistently ends up as a constant... : : I'll try to explain a little more. But first, forget about the RAM/ROM : issue, it was a mistake to include that in the original post. : : 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? [snip] : As I noted in the original post, this can be (and is today) solved by : manually putting GenerateTable into its own program and the pasting the : output into the source of package BlahBlah. This has caused management : problems and I expect it to continue to do so. 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...) : 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).