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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d8aa0b11d3c79b63 X-Google-Attributes: gid103376,public From: Christoph Grein Subject: Re: Access to strings and string subtypes? Date: 2000/03/17 Message-ID: <200003170513.GAA28983@bulgaria.otn.eurocopter.de>#1/1 X-Deja-AN: 600487434 To: comp.lang.ada@ada.eu.org Content-Type: TEXT/plain; charset=us-ascii Content-MD5: amZpDzMLcBcad+qprDjcOA== X-Complaints-To: usenet@enst.fr X-Trace: menuisier.enst.fr 953661199 29563 137.194.161.2 (21 Mar 2000 17:53:19 GMT) Organization: ENST, France X-BeenThere: comp.lang.ada@ada.eu.org Mime-Version: 1.0 Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Date: 21 Mar 2000 17:53:19 GMT Newsgroups: comp.lang.ada Date: 2000-03-21T17:53:19+00:00 List-Id: package Test is type Ref is access all String; <-- unconstrained subtype Name is String(1..10); <-- constrained type Name_Ref is access all Name; A : aliased Name; <-- constrained C : aliased String (1..10); <-- constrained D : Name_Ref := A'Access; -- OK E : Ref := A'Access; -- Does not statically match designated subtype ??? F : Ref := C'Access; -- Does not statically match designated subtype ??? G : Ref := new String'("THIS WORKS"); -- OK! end Test; The compiler message ("Does not statically match designated subtype") says exactly what is wrong: A pointer to an unconstrained string has to take care of the actual object's ranges, a pointer to a constrained string need not. Thus A'Access and C'Access do not provide range information whereas new String'("THIS WORKS") does.