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-03-27 23:44:22 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!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, 28 Mar 2001 09:17:26 +0200 Organization: MIDA Systemutveckling AB Message-ID: <3AC19006.E9962012@mida.se> References: <3AC03CCE.70E3C2D5@mida.se> NNTP-Posting-Host: sdu184-72.ppp.algonet.se Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: zingo.tninet.se 985765044 17383 195.163.72.184 (28 Mar 2001 07:37:24 GMT) X-Complaints-To: abuse@algo.net NNTP-Posting-Date: 28 Mar 2001 07:37:24 GMT X-Mailer: Mozilla 4.6 [en] (WinNT; I) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:6150 Date: 2001-03-28T07:37:24+00:00 List-Id: Ted Dennison wrote: %< > >I have hoped to get the time to either build a small preprocessor to do > >this kind of execution/substitution trick, or to add the same trick into > >GNAT using some pragma(Compiler_Executed, func). Sorry to say, I don't > >see that ammount of time in the near future. > > If you are talking about being able to run pretty much *any* code at compile > time, no that can't be done with just a "trick". I don't know of any language in > existance (but I suppose there probably is one somewhere) that will let you do > that. It might be doable for a self-hosted system, but for a cross-compiled > system (which I suspect is your situation, otherwise you wouldn't be worrying > about making the result ROMable) I don't think it would be possible at all. The > cross compiler would also have to include a full-fledged native compiler! This IS what I'm dreaming of. Of course a lot of restrictions on what code is allowed to execute (sideeffects etc). Ofcourse you'll need a native compiler to compile the initialization function (and all code that it uses). The analysis of the code, regarding weather it can be allowed is probably so complex that it's best done from within the compiler, and not in some kind of preprocessor. I still hope to get some time to experiment with gnat (after all I have to have the native compiler to build the crosscompiler anyway). -- 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