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=-2.8 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, PLING_QUERY autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,478ee4201c470ff5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-29 23:01:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor-online.net!fr.clara.net!heighliner.fr.clara.net!freenix!enst.fr!not-for-mail From: "Grein, Christoph" Newsgroups: comp.lang.ada Subject: Re: Repost: Nobody interested to judge which compiler is right?! Date: Thu, 30 Jan 2003 07:53:06 +0100 (MET) Organization: ENST, France Message-ID: Reply-To: "Grein, Christoph" , "comp.lang.ada mail to news gateway" NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1043910059 8324 137.194.161.2 (30 Jan 2003 07:00:59 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 30 Jan 2003 07:00:59 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: azHbckaBLj0cnOQDoIB44Q== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.1 Precedence: list List-Id: comp.lang.ada mail to news gateway List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:33592 Date: 2003-01-30T07:53:06+01:00 Well I'm no language lawyer, but in my opinion, Gnat is wrong and Aonix is right. > with Ada.Strings.Fixed; use Ada.Strings.Fixed; > with Ada.Text_IO; use Ada.Text_IO; > > procedure Tiny is > -- Is this code valid ?! > > type String_Access is access all String; > > subtype Len_Positive is Positive range 1 .. 20; > subtype Len_String is String ( Len_Positive ); > subtype Len_String_Access is String_Access( Len_Positive ); > > LS : aliased Len_String := Len_String'Length * "*"; > > > -- \/ This compiles with GNAT, but not with Aonix > LSA : Len_String_Access := LS'access; > > > begin > > -- \/ This compiles with GNAT, but not with Aonix > Put_Line( LSA.all ); > > end Tiny; LS nominal and actual subtypes are the same: Len_String The designated subtype of String_Access and Len_String_Access both are String, i.e. an unconstrainted subtype. This is from a note of Tucker Taft on Team Ada March 1999. I have no longer the exact English wording, I retranslate from German: "The designated subtype is determined by the declaration of an access type, it is the same for all subtypes of that access type, even when the access subtypes pose some constraints on the designated subtype." You could try LS : aliased String := Len_String'Length * "*"; Now the nominal subtype of LS is String, the actual subtype is Len_String, i.e. LS is constrained by its initial value. Now the subtypes match and LSA : Len_String_Access := LS'access; should be OK. (Warning: I haven't compiled this.)