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 07:14:47 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!hub.org!hub.org!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison Sender: usenet@www.newsranger.com References: <3AC03CCE.70E3C2D5@mida.se> Subject: Re: Compile time executed functions Message-ID: <132w6.3493$fy.5811@www.newsranger.com> Date: Tue, 27 Mar 2001 15:09:49 GMT NNTP-Posting-Host: 127.0.0.1 X-Complaints-To: abuse@newsranger.com X-Trace: www.newsranger.com 985705789 127.0.0.1 (Tue, 27 Mar 2001 10:09:49 EST) NNTP-Posting-Date: Tue, 27 Mar 2001 10:09:49 EST Organization: http://www.newsranger.com Xref: supernews.google.com comp.lang.ada:6116 Date: 2001-03-27T15:09:49+00:00 List-Id: In article , Robert A Duff says... > >Mats Karlssohn writes: > >> Sometimes, especially when doing embedded programming, I feel a great >> need to execute a function to get literal initialization a constant. >> That is I'd like to have the compiler to execute a function for me (at >> compiletime!) and use the return of that function to initialize the >> constant. > >If you inline the function, you are likely to get what you want, >depending on how good the compiler's support for inlining is. He also wanted the result of the function to be put into the ROM area when the executable is created by the compiler. Inlining wouldn't do that, would it? It just prevents the little extra subprogram call overhead (saving and restoring the register context, etc) when the function is called at runtime. --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com