comp.lang.ada
 help / color / mirror / Atom feed
From: Ben Bacarisse <ben.usenet@bsb.me.uk>
Subject: Re: Integer_IO or Modular_IO with different base as default
Date: Mon, 15 Nov 2021 22:13:28 +0000	[thread overview]
Message-ID: <87tugdnk3b.fsf@bsb.me.uk> (raw)
In-Reply-To: 49db08e4-4380-4877-9e50-a986856c9821n@googlegroups.com

Ken Roberts <alisonken1@gmail.com> writes:

> Does anyone have an idea on how to instantiate Integer_IO (or
> Modular_IO) with Default_Base := 8 ?

Instantiate Integer_IO and then assign Default_Base := 8:

with Ada.Text_IO; use Ada.Text_IO;
procedure Oct is
  package Oct_IO is new Integer_IO(Integer);
begin
  Oct_IO.Default_Base := 8;
  Oct_IO.Put(16);
end Oct;

(Add "use Oct_IO;" if you prefer.)

I don't think there is a way to do this on instantiation so that
Default_Base is 8 and can't be changed, which would be nice.  (Note: my
Ada is /very/ rusty.  Take /anyone's/ answer over mine about this!)

-- 
Ben.

      parent reply	other threads:[~2021-11-15 22:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 21:27 Integer_IO or Modular_IO with different base as default Ken Roberts
2021-11-15 21:40 ` Simon Wright
2021-11-15 22:09   ` Ken Roberts
2021-11-15 23:10     ` Jeffrey R.Carter
2021-11-19  0:06       ` Ken Roberts
2021-11-15 22:13 ` Ben Bacarisse [this message]
replies disabled

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