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: border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.fsmpi.rwth-aachen.de!feeder.erje.net!us.feeder.erje.net!xmission!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: 4 beginner's questions on the PL Ada Date: Fri, 09 Aug 2013 18:08:06 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <87ob96ajv6.fsf@VLAN-3434.student.uu.se> <03ea570b-e45f-4694-ab9b-3413c4770379@googlegroups.com> <878v0aee8i.fsf@VLAN-3434.student.uu.se> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1376086086 16063 192.74.137.71 (9 Aug 2013 22:08:06 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 9 Aug 2013 22:08:06 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:6eCvEptYR5lHbVvq2GUUhyFFuLY= Xref: number.nntp.dca.giganews.com comp.lang.ada:182905 Date: 2013-08-09T18:08:06-04:00 List-Id: Emanuel Berg writes: > Task_Name : constant String := Image(Current_Task); > > It produces output like > > add_one_081838Dt I doubt that "t". ;-) > if the task is referred to as Add_One in the code. > > The 8-char code that follows doesn't look like anything I > recognize. Is it a random string ID, or is is generated out of > anything sensible? If it always is 8 chars (and an underscore), I > guess I could simply trim the strings. It is the address of the task control block in hexadecimal, which can vary in length -- e.g. on a 64-bit machine, it will be 16 characters. You should read the GNAT documentation on Task_Identification.Image. Also doc for pragma Task_Name. This is all GNAT-specific, of course. Some other Ada compiler can return something completely different. Trimming the string might not be a good idea -- it uniquely identifies the task in case the name part doesn't. But it shouldn't be hard to write a trimming function that won't crash on any Ada implementation, while doing what you like for GNAT. - Bob