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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f3514db0a21f9b44 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!a39g2000prb.googlegroups.com!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Hexadecimal and stream element arrays Date: Tue, 20 Apr 2010 15:21:22 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <82fx2q4mbu.fsf@stephe-leake.org> NNTP-Posting-Host: 75.244.27.119 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1271802083 32052 127.0.0.1 (20 Apr 2010 22:21:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 20 Apr 2010 22:21:23 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a39g2000prb.googlegroups.com; posting-host=75.244.27.119; posting-account=yOOUcAoAAABjcyl4BUJf9FM0ne56zA9Q User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:11065 Date: 2010-04-20T15:21:22-07:00 List-Id: On Apr 20, 12:25=A0am, Stephen Leake wrote: > > generic > =A0 =A0Width : Natural; > =A0 =A0type Number_Type is mod <>; > function SAL.Generic_Hex_Image (Item : in Number_Type) return String; > -- =A0Return a hexadecimal image of Item, padded with leading zeros to > -- =A0Width. If Width is too small for Item, leading digits are silently > -- =A0truncated. So if I sometimes want different widths for the same type, I have to have multiple instantiations? That doesn't seem very friendly to me. I don't see why Width couldn't be a parameter of the function, probably defaulted to Number_Type'Width. What do I do for signed integer images, for bases other than 16, and for signed integer images for bases other than 16? Do I have to roll my own for these cases? In Ada.Text_IO, a Width of zero implies the minimum width needed to represent the value; here it's an expensive way to get a null String. I'd prefer consistency with the standard. I haven't used SAL, but these are the kind of comments you'd probably get from me if I did use this function. HTH.