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!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: 4 beginner's questions on the PL Ada Date: Fri, 09 Aug 2013 15:00:10 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: <87ob96ajv6.fsf@VLAN-3434.student.uu.se> <03ea570b-e45f-4694-ab9b-3413c4770379@googlegroups.com> <878v0aee8i.fsf@VLAN-3434.student.uu.se> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 9 Aug 2013 22:00:11 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="da68e1c0dc00d4aa5d0283c494e3a17a"; logging-data="29687"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18e3DWPeDeaHLmS4BR7Opva0HOLHJszd0k=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: <878v0aee8i.fsf@VLAN-3434.student.uu.se> Cancel-Lock: sha1:1eqt17ckUXpq3VmnRaRnnxsv6Js= Xref: news.eternal-september.org comp.lang.ada:16745 Date: 2013-08-09T15:00:10-07:00 List-Id: On 08/09/2013 02:38 PM, Emanuel Berg wrote: > > Yes! This works great: > > with Ada.Task_Identification; > use Ada.Task_Identification; > > Task_Name : constant String := Image(Current_Task); > > It produces output like > > add_one_081838Dt > > if the task is referred to as Add_One in the code. Not necessarily. First, this is only available in compilers that choose to implement the optional Annex C, Systems Programming, so this is non-portable. Second, the contents of the string returned by Image are implementation defined. One particular compiler uses the task name as part of the returned value, but others might not, so adding another layer of non-portability. This may not be a concern for your present needs, though unnecessary non-portability usually bites you sooner or later in real projects. An advantage of the technique used in PragmARC.Reflection is that it is part of the core language, and so implemented by all compilers, and the resulting string is defined by the language, and so is the same for all compilers. -- Jeff Carter "Well, a gala day is enough for me. I don't think I can handle any more." Duck Soup 93