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!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: How to get this space away? Date: Mon, 8 Jun 2015 14:47:38 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <0b23f4af-9a55-4d1d-be90-f74b316a95cf@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1433792859 21829 24.196.82.226 (8 Jun 2015 19:47:39 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 8 Jun 2015 19:47:39 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:26222 Date: 2015-06-08T14:47:38-05:00 List-Id: "Brad Moore" wrote in message news:BYfdx.40257$ic6.28837@fx17.iad... > On 2015-06-03 05:00 PM, Randy Brukardt wrote: ... >> Right, and the effort (in the Standard and especially for implementers) >> probably outweights the value. > > Try formatting 4 unsigned byte values as an quad dot IP address string, > for example. > Something that can be easily expressed in another language such as C in > one line of code is very awkward and ugly to write in Ada. It's not *that* awkward. Since 'Image has to return a string that 'First = 1, the following works fine (7 lines, well-formatted, could be less - assuming the parts are declared as bytes appropriately as they are in Claw.Sockets): declare A_Img : constant String := Byte'Image(IP.A); B_Img : constant String := Byte'Image(IP.B); C_Img : constant String := Byte'Image(IP.C); D_Img : constant String := Byte'Image(IP.D); begin Put (A_Img(2..A_Img'Last) & '.' & B_Img(2..B_Img'Last) & '.' & C_Img(2..C_Img'Last) & '.' & C_Img(2..C_Img'Last); end; And of course such a thing should be a subprogram (in any language) because you're going to use it enough (at least for debugging) that repeating it is silly. Now, if you prefer to have each part to take up three characters with leading zeros except for the first (so they're all the same length) -- that'll take a bit more than a handful of lines in Ada. Ada's formatting is primitive, except in the rarely thought of Annex F (does anyone use that?). Randy.