From: russ lyttle <lyttlec@removegmail.com>
Subject: Re: Gnat Problem - Freezing too soon
Date: Sun, 3 Mar 2019 15:42:12 -0500
Date: 2019-03-03T15:42:12-05:00 [thread overview]
Message-ID: <q5he73$3jm$1@gioia.aioe.org> (raw)
In-Reply-To: lyk1hhgds8.fsf@pushface.org
On 3/2/19 4:35 PM, Simon Wright wrote:
> russ lyttle <lyttlec@removegmail.com> 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.
>
There is a misspelling: Prioriy => Priority. Correct that misspelling
and the idiom _sometimes_ works without the "not null". The bug report
had an instance of where the compiler failed. Would it be helpful to add
an instance where it passed?
>> 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.
>
That's a good reason :)
next prev parent reply other threads:[~2019-03-03 20:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-28 18:34 Gnat Problem - Freezing too soon russ lyttle
2019-02-28 21:19 ` Anh Vo
2019-02-28 21:31 ` russ lyttle
2019-02-28 21:22 ` Simon Wright
2019-02-28 22:11 ` russ lyttle
2019-03-01 0:49 ` Anh Vo
2019-03-01 14:21 ` russ lyttle
2019-03-01 16:54 ` Anh Vo
2019-03-01 21:50 ` russ lyttle
2019-03-02 1:08 ` Anh Vo
2019-03-02 3:55 ` russ lyttle
2019-03-02 5:50 ` Anh Vo
2019-03-02 20:19 ` russ lyttle
2019-03-02 21:35 ` Simon Wright
2019-03-03 20:42 ` russ lyttle [this message]
2019-03-03 21:26 ` Simon Wright
2019-03-04 0:33 ` russ lyttle
2019-03-02 14:09 ` Simon Wright
2019-03-01 8:12 ` Simon Wright
2019-03-01 14:17 ` russ lyttle
2019-03-01 18:10 ` Simon Wright
2019-03-01 21:35 ` russ lyttle
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox