comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <ggsub@pragmada.x10hosting.com>
Subject: Re: Hexadecimal and stream element arrays
Date: Tue, 20 Apr 2010 15:21:22 -0700 (PDT)
Date: 2010-04-20T15:21:22-07:00	[thread overview]
Message-ID: <abd54875-ef6a-4d67-8235-2830f9d76a76@a39g2000prb.googlegroups.com> (raw)
In-Reply-To: 82fx2q4mbu.fsf@stephe-leake.org

On Apr 20, 12:25 am, Stephen Leake <stephen_le...@stephe-leake.org>
wrote:
>
> generic
>    Width : Natural;
>    type Number_Type is mod <>;
> function SAL.Generic_Hex_Image (Item : in Number_Type) return String;
> --  Return a hexadecimal image of Item, padded with leading zeros to
> --  Width. If Width is too small for Item, leading digits are silently
> --  truncated.

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.



  reply	other threads:[~2010-04-20 22:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-19 15:44 Hexadecimal and stream element arrays tonyg
2010-04-19 15:58 ` tonyg
2010-04-19 16:24   ` Ludovic Brenta
2010-04-19 16:27     ` tonyg
2010-04-19 17:02       ` tonyg
2010-04-19 17:26         ` tonyg
2010-04-19 20:50           ` Ludovic Brenta
2010-04-20  9:00             ` tonyg
2010-04-20  9:25               ` Peter Hermann
2010-04-19 18:05     ` Warren
2010-04-19 19:21       ` Jeffrey R. Carter
2010-04-19 19:28         ` Warren
2010-04-19 23:21           ` John B. Matthews
2010-04-19 23:22           ` Adam Beneschan
2010-04-20 14:04             ` Warren
2010-04-20 14:46               ` J-P. Rosen
2010-04-20 15:52                 ` Warren
2010-04-19 19:17     ` Jeffrey R. Carter
2010-04-19 20:52       ` Ludovic Brenta
2010-04-19 23:34         ` Jeffrey R. Carter
2010-04-19 17:20   ` John B. Matthews
2010-04-19 17:27   ` Dmitry A. Kazakov
2010-04-19 17:55     ` tonyg
2010-04-20  7:25 ` Stephen Leake
2010-04-20 22:21   ` Jeffrey R. Carter [this message]
2010-04-21 12:38     ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox