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-27 15:39:45 PST Path: supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news.stealth.net!64.154.60.72.MISMATCH!cyclone2.usenetserver.com!news-out.usenetserver.com!newscon06.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> <132w6.3493$fy.5811@www.newsranger.com> 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.67.100.72 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr16.news.prodigy.com 985736178 6207069 65.67.100.72 (Tue, 27 Mar 2001 18:36:18 EST) NNTP-Posting-Date: Tue, 27 Mar 2001 18:36:18 EST Date: Tue, 27 Mar 2001 23:36:18 GMT Xref: supernews.google.com comp.lang.ada:6145 Date: 2001-03-27T23:36:18+00:00 List-Id: "Ted Dennison" wrote in message news:132w6.3493$fy.5811@www.newsranger.com... : 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. It might - my experience is that inlining is more likely to result in evaluation to a ROMable constant with a good compiler. However, there's a lot of other factors involved.