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!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Real tasking problems with Ada. Date: Fri, 4 Aug 2017 18:16:33 -0500 Organization: JSA Research & Innovation Message-ID: References: <9e51f87c-3b54-4d09-b9ca-e3c6a6e8940a@googlegroups.com> Injection-Date: Fri, 4 Aug 2017 23:16:34 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="13811"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: news.eternal-september.org comp.lang.ada:47592 Date: 2017-08-04T18:16:33-05:00 List-Id: "Simon Wright" wrote in message news:ly4ltpqdrm.fsf@pushface.org... > Robert Eachus 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.