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,baa6871d466e5af9 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: AQ&S Guidance on pragma Elaborate_Body Date: 1997/04/19 Message-ID: #1/1 X-Deja-AN: 236006165 References: <528878564wnr@diphi.demon.co.uk> <5jabeq$3ltk@info4.rus.uni-stuttgart.de> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-04-19T00:00:00+00:00 List-Id: In article <5jabeq$3ltk@info4.rus.uni-stuttgart.de>, Michael Paus wrote: >Hm ? If there is such a simple and strict rule on how to apply this >kind of pragmas, I wonder why the compiler does not do it automatically. >The compiler does check whether my pragma settings are correct. So it >seems to be quite straight forward for the compiler to automatically >insert the highest level of purity. Are there any undesirable side >effects when doing that or is the rule not as simple as you said ? The compiler can't do it, because that would require knowing about a package body when compiling the package spec (or clients of the package spec). You could do it automatically at link time, but not at compile time (given Ada's compilation model). By "it", I mean "insert Pure, Preelaborate, or Elab_Body, as appropriate." Elaborate_All and Elaborate are somewhat more complicated to deal with. If you're willing to live with some restrictions, and some complicated (slow?) processing at link time, you could dispense with all elaboration-control pragmas, and have the link phase determine an elaboration order that's guaranteed to not raise Program_Error. But note that some of these pragmas (Pure, especially) have purposes other than just elaboration order. - Bob