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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,442eb9212004f30 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!y21g2000hsf.googlegroups.com!not-for-mail From: Anh Vo Newsgroups: comp.lang.ada Subject: Re: Problem using Ada.Text_IO.Modular_IO Date: Wed, 9 Jul 2008 12:03:59 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <4eab7055-df3d-4d56-87da-8248829da1da@26g2000hsk.googlegroups.com> NNTP-Posting-Host: 209.225.224.254 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1215630239 26444 127.0.0.1 (9 Jul 2008 19:03:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 9 Jul 2008 19:03:59 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y21g2000hsf.googlegroups.com; posting-host=209.225.224.254; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 3.0.04506.648),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:1051 Date: 2008-07-09T12:03:59-07:00 List-Id: On Jul 9, 9:52=A0am, jujo...@googlemail.com wrote: > Dear All, > > I'm tying to print variables of a defined modular type to the standard > io and a file. > The type I'm working with is: type Unsigned is mod 2**64; > > Therefore I define a modular_io package to do this: > package mio is new ada.text_io.modular_io(usigned); > > However, when compile my little test program (using gnatmake -gnato), > the compiler tells me that a "Constraint Error" will be raised at > runtime. So I tried it with only 63 bit (mod 2**63), which works fine > with the GNAT 4.3.1 (20080420) on a 32bit Ubuntu-Linux machine. > > ----------- test program ----------- > with ada.text_io; use ada.text_io; > procedure test is > =A0 =A0 =A0 =A0 type Unsigned is mod 2**64; > =A0 =A0 =A0 =A0 package M_IO is new Ada.Text_IO.Modular_IO (Unsigned); > =A0 =A0 =A0 =A0 u : Unsigned :=3D -1; > begin > =A0 =A0 =A0 =A0 m_io.put(Item =3D> =A0u, Width =3D> =A020, Base =A0=3D> 1= 6); > end; > ----------------------------------------- > > I guess that this is a bug. However, what can I do instead of this, to > get 64 bit words printed as hex, octal and binary? If you make u a constant Unsigned, it works as intended. Is it a bug as far as GNAT is concerned? I am not so sure about it. I need to check the LRM thouroughly before drawing my conclusion. AV