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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Gnat Problem - Freezing too soon Date: Sat, 02 Mar 2019 21:35:51 +0000 Organization: A noiseless patient Spider Message-ID: References: <2c369d78-70ea-4593-af3d-e014b0c1fc00@googlegroups.com> <4081906e-91de-43fa-a816-067f707c6d7d@googlegroups.com> <161c749f-b9db-465f-8ffe-7900d3a4bff5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="b88c6942e614def0f1679685512ea675"; logging-data="23532"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rsSGHwXBx4zt3FmzBk6Fv/qq3WhP16Xg=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) Cancel-Lock: sha1:seDoMnVxcb4qu/pBnBm+zyygYFk= sha1:MkeyCLTSfDzmU0Ozuzj3DzEkw10= Xref: reader01.eternal-september.org comp.lang.ada:55768 Date: 2019-03-02T21:35:51+00:00 List-Id: russ lyttle writes: > I meant why it solved this particular problem. As far as I can tell, > the authors never used the "not null" in any of their books. Would > other compilers accept the code as written, or should the code be > considered erroneous? 'not null' is clearly better style. With regard to task type Sporadic (S : Any_Sporadic_State; A : Any_Sporadic_Thread_Interface) with Priority => S.pri is GNAT CE 2018 fails, GNAT GPL 2017 & earlier & GCC 9 succeed. You can see that making the type 'not null' would eliminate a check (check would be done at the call site instead), so that the internal tree generated by the compiler would be different, and the compiler may have been changed in this region for other reasons. With regard to protected type Sporadic_Agent (S: Any_Sporadic_State) with Priority => S.Ceiling_Prioriy is all the compilers are seriously confused: sporadics.ada:30:22: no selector "Ceiling_Prioriy" for type "Sporadic_State'Class" defined at line 17 sporadics.ada:30:23: possible misspelling of "Ceiling_Priority" sporadics.ada:30:23: possible misspelling of "Ceiling_Priority" sporadics.ada:30:23: possible misspelling of "Ceiling_Priority" and you only have to look at the task equivalent above to see that it should have been OK. This one looks like another compiler error to me. > As Simon pointed out replacing "with Priority => S.pri" with "pragma > Priority(S.pri)" also works. They never used that form either. > > Why would the authors prefer one form over the others? The aspect is the newer form; the book was published in 2016, so they'd have gone with that.