From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Real tasking problems with Ada.
Date: Fri, 4 Aug 2017 18:16:33 -0500
Date: 2017-08-04T18:16:33-05:00 [thread overview]
Message-ID: <om2v8i$dfj$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: ly4ltpqdrm.fsf@pushface.org
"Simon Wright" <simon@pushface.org> wrote in message
news:ly4ltpqdrm.fsf@pushface.org...
> Robert Eachus <rieachus@comcast.net> writes:
>
>> Sigh! Get_Id as defined is heavy only because of the default initial
>> value:
>>
>> function Get_CPU
>> (T : Ada.Task_Identification.Task_Id :=
>> Ada.Task_Identification.Current_Task)
>> return CPU_Range;
>
> Would it have been reasonable to have used Null_Task_Id to mean 'the
> current task'? (this is a trick used in FreeRTOS at least).
There are rules about when Current_Task is not well-defined (or can raise
Program_Error, as it is a bounded error to call it in some places). By using
that here, we don't have to repeat them in every place that might care about
the current task. If you used Null_Task_Id as a placeholder, you would have
to say that Get_CPU is not well-defined (or even when it can raise
Program_Error).
You'd also lose the null value for representing "no task", which seems to be
a common requirement for any kind of type.
Thus, that's not the worst idea, but it would be a pain to define and
possibly would cause issues for anything that needs to represent "no task"
(such as the default initialization of a data structure).
Randy.
prev parent reply other threads:[~2017-08-04 23:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-25 23:19 Real tasking problems with Ada Robert Eachus
2017-07-26 19:42 ` sbelmont700
2017-07-27 2:00 ` Robert Eachus
2017-08-01 4:45 ` Randy Brukardt
2017-08-02 2:23 ` Robert Eachus
2017-08-03 3:43 ` Randy Brukardt
2017-08-03 20:03 ` Robert Eachus
2017-08-03 23:10 ` Luke A. Guest
2017-08-04 23:22 ` Randy Brukardt
2017-08-22 5:10 ` Robert Eachus
2017-08-01 4:41 ` Randy Brukardt
2017-08-02 3:44 ` Robert Eachus
2017-08-02 14:39 ` Lucretia
2017-08-03 0:57 ` Robert Eachus
2017-08-03 5:43 ` Randy Brukardt
2017-08-03 1:33 ` Wesley Pan
2017-08-03 4:30 ` Randy Brukardt
2017-08-03 4:16 ` Randy Brukardt
2017-08-03 5:05 ` Niklas Holsti
2017-08-04 23:11 ` Randy Brukardt
2017-08-05 7:01 ` Niklas Holsti
2017-08-03 8:03 ` Simon Wright
2017-08-04 23:16 ` Randy Brukardt [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox