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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Constants vs Functions (was Re: Optimizing recursion...) Date: 1998/08/27 Message-ID: #1/1 X-Deja-AN: 385389795 References: <6qfhri$gs7$1@nnrp1.dejanews.com> <35cb8058.645630787@news.ne.mediaone.net> <902934874.2099.0.nnrp-10.c246a717@news.demon.co.uk> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1998-08-27T00:00:00+00:00 List-Id: In article <6s43nq$m31$1@berlin.infomatch.com> blaak@infomatch.com (Ray Blaak) writes: > This is a sound suggestion, but one problem with it is that such constants > tend to be used to define ranges, array sizes, etc. If it is not a constant > then the static property is lost, and things like compile-time fixed-sized > arrays, and constraint check elimination become difficult. There are two issues here, one is that there are places where Ada requires values which meet the reference manual definition of static. In those cases, you have to follow the rules of RM4.9, which in Ada 95 do permit function calls, but nothing like this. Of course the only two cases where you are ever likely to run into this issue are in the declarations of scalar numeric types and in representation clauses. (Note that I am being tricky there. It really is the parameters which determine the base type which must be static The second case, which is much more common, is where the language rules will define an expression to be non-static, but decent Ada compilers will do the optimizations IF you have the pragma there (and optimization turned on). Try it and see. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...