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!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Running a preprocessor from GPS? Date: Thu, 30 Jul 2015 16:58:56 +0100 Organization: A noiseless patient Spider Message-ID: References: <2df4698f-4c8e-457c-822d-209cb2f8ab5e@googlegroups.com> <877fpi84o6.fsf@adaheads.sparre-andersen.dk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="fbe1d5b0173017f7cc2ccfa8ad3bc8c1"; logging-data="21423"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UHPqdb5XFlUq8zOpNF5lkCg+r5Aikxug=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:TVwBh7GzAYNEDhTo1/Ht1JTBkos= sha1:yZF7t8nKYiod/5+9TOiKEvSon6c= Xref: news.eternal-september.org comp.lang.ada:27221 Date: 2015-07-30T16:58:56+01:00 List-Id: "G.B." writes: > On 30.07.15 09:50, Jacob Sparre Andersen wrote: >> Simon Wright wrote: >>>> Simon Wright wrote: >> >>>>> return Tick * Time_Base ((if System.FreeRTOS.Tasks.In_ISR >>>>> then xTaskGetTickCountFromISR >>>>> else xTaskGetTickCount)); >> >>> I dunno. The version below is quite verbose, and verges on being less >>> readable. But this is a style issue, I think. >>> >>> if System.FreeRTOS.Tasks.In_ISR then >>> return Tick * Time_Base (xTaskGetTickCountFromISR); >>> else >>> return Tick * Time_Base (xTaskGetTickCount); >>> end if; >> >> I definitely find the latter more readable than the former (at least >> without syntax highlighting). > > We now have named conditional expressions, so > > function GetTickCount return T > is ((if System.FreeRTOS.Tasks.In_Isr > then xTaskGetTickCountFromISR > else xTaskGetTickCount)); > begin > return Tick * Time_Base (GetTickCount); > end An interesting way to think of it! I _think_that in this case it's getting a little too obfuscatory.