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,2f343e3986ead102 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!m3g2000hsc.googlegroups.com!not-for-mail From: Matthew Heaney Newsgroups: comp.lang.ada Subject: Re: String declaration and initialization Date: Thu, 22 May 2008 11:16:22 -0700 (PDT) Organization: http://groups.google.com Message-ID: <37455a58-73f4-4c68-afbd-7dc405de78d8@m3g2000hsc.googlegroups.com> References: <05bce551-cd98-417c-8664-847b29124c19@l64g2000hse.googlegroups.com> NNTP-Posting-Host: 66.162.65.129 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1211480182 16863 127.0.0.1 (22 May 2008 18:16:22 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 22 May 2008 18:16:22 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m3g2000hsc.googlegroups.com; posting-host=66.162.65.129; posting-account=umyUbgkAAADe5rQC4VzV-ffCoH4N30u3 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:295 Date: 2008-05-22T11:16:22-07:00 List-Id: On May 22, 12:58=A0pm, S=E9bastien wrote: > > > declare > > =A0 Test1 : aliased constant String :=3D "test1"; > > =A0 Test2 : aliased constant String :=3D "test2"; > > > =A0 type Table_Type is array (Test_Type) of > > =A0 =A0 not null access constant String; > > > =A0 Table : constant Table_Type :=3D > > =A0 =A0 (T1 =3D> Test1'Access, > > =A0 =A0 =A0T2 =3D> Test2'Access, > > =A0 =A0 =A0...); > > > =A0 S : String renames Table (Some_Test).all; > > begin > > ... > > end; > > That's an idea but... Test1 are actually not a constant string, that was > an example :-) It's calculated sometime it's even a return of some > function and so on. That doesn't really change anything. You could say: declare Test1 : aliased constant String :=3D Result_Of_Function1; Test2 : aliased constant String :=3D Result_Of_Function2; =2E.. begin > =A0 =A0 =A0MyTreatment1(buffer.all, buffer.all'Size); What are you trying to do here? Why can't you simply declare MyTreatment1 like this: procedure MyTreatment1 (S : String) is ...; and then call it like this: MyTreatment1 (buffer.all); > end; > > but it doesn't work of course since I can't create with new an > unconstrained object. No, Bob showed you what to do: ... new String'("this is my string");