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,7bf23c8e794b6462 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.scarlet.biz!news.scarlet.biz.POSTED!not-for-mail NNTP-Posting-Date: Tue, 14 Nov 2006 19:17:55 -0600 From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: STRING length References: <1163544675.070347.64490@h54g2000cwb.googlegroups.com> <1163543045.5361.12.camel@localhost.localdomain> <1163551453.005505.131470@h54g2000cwb.googlegroups.com> Date: Wed, 15 Nov 2006 02:17:48 +0100 Message-ID: <87bqn94if7.fsf@ludovic-brenta.org> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:dwefQ26ifcPhQQKjKsMv7QrJlcs= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 62.235.222.97 X-Trace: sv3-A32x7UDvkahBikInacIdRBBTOKRpw19+N4rPBnlC1TJTj5RsXmWeL8zd5KDSkRPGi9QljE9X0Bp7tmE!p4hsn4gK6U/l2voC14sOr/0uHEf4h0mqXCgaWoD8sS0bB61modlxPf40VQbAzJHwpcKlTTltgQ== X-Complaints-To: abuse@scarlet.be X-DMCA-Complaints-To: abuse@scarlet.biz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:7460 Date: 2006-11-15T02:17:48+01:00 List-Id: markww writes: > Thanks Georg, that looks to be exactly what I need. I do have a problem > '#including', or, 'withing' rather unbounded string. > Now the head of my source file looks like: > > with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings.Unbounded; > use Ada.Text_IO, Ada.Integer_Text_IO; > > which is alright but as soon as I try: > > use Ada.Strings.Unbounded; > > the compiler gives me a bunch of errors, it seems to conflict with > Text_IO / Integer_Text_IO? Seems like all my previous calls to Put() > now became invalid. I'm not familiar with Ada but with C++ and > understand namespace collisions, is the same thing going on here? In theory, a use clause may make subprogram calls ambiguous and thus illegal, but I don't think that's your problem here, because Ada.Strings.Unbounded does not contain any Put subprogram that might collide with those in Ada.Text_IO or Ada.Integer_Text_IO. Instead, I think that your problem stems from the the use clause making the following operators directly visible (from ARM A.4.5): 15. function "&" (Left, Right : in Unbounded_String) return Unbounded_String; 16. function "&" (Left : in Unbounded_String; Right : in String) return Unbounded_String; 17. function "&" (Left : in String; Right : in Unbounded_String) return Unbounded_String; 18. function "&" (Left : in Unbounded_String; Right : in Character) return Unbounded_String; 19. function "&" (Left : in Character; Right : in Unbounded_String) return Unbounded_String; so now you're constructing unbounded strings by concatenating strings and unbounded strings, and passing them to Ada.Text_IO.Put, which is of course illegal. You should convert the unbounded strings to regular strings before passing them to Ada.Text_IO.Put, like so: with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO; procedure Foo is S : Unbounded_String := "Hello" & To_Unbounded_String (", world!"); -- calls Ada.Strings.Unbounded."&" which is directly visible begin Ada.Text_IO.Put (To_String (S)); -- convert and print end Foo; HTH -- Ludovic Brenta.