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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME 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: "Nick Roberts" Subject: Re: AQ&S Guidance on pragma Elaborate_Body Date: 1997/04/26 Message-ID: <01bc5253$1840e2c0$28f982c1@xhv46.dial.pipex.com>#1/1 X-Deja-AN: 237542560 References: <528878564wnr@diphi.demon.co.uk> <5jfukp$lda@top.mitre.org> <5jq9uc$kuf@top.mitre.org> Organization: UUNet PIPEX server (post doesn't reflect views of UUNet PIPEX) Newsgroups: comp.lang.ada Date: 1997-04-26T00:00:00+00:00 List-Id: Michael F Brenner wrote in article <5jq9uc$kuf@top.mitre.org>... > The link between pragma pure and thread safety is that thread safety is > a memory concern, and the concept of a pure package is to be memory-free, > and therefore as thread safe as any code can be. That is why optimizers > are permitted to optimize away multiple calls to procedures in pure > packages--they have NO memory. If they had memory, and therefore > potential thread-unsafeness, they ARE NOT pure, and it would be fibbing > to mark them pure, and the optimized-away calls will be an undesireable > effect on the execution of the code. The purity is transitive, since > everything imported (withed) by a pure package must be pure. Therefore, > if you call, for example, some pure_io.put_line several times during > the debugging of a pure package, only the first pure_io.put_line would > actually be called! > > The second, and all further calls to pure_io.put_line would generate no > code (i.e., in DEC Vaxen Ada language, would be optimized away). Surely it would be a 'very poor' (substitute your favourite expletive) compiler which 'optimized away' a second or subsequent call to a procedure with only 'in' parameters defined in a pure package (as in Michael's example)? Moreover (and much earlier), if a compiler were to come across a procedure which only has 'in' parameters declared in a pure package, surely to God it should give a big fat warning message? I don't know if the language (Ada 95) allows it, but it would really be best for the compiler to give up (with a fatal error), since this would certainly indicate a bug (wouldn't it?). Excellent post, by the way, Michael. Nick.