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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,704a2a0ee079967 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-26 04:04:33 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!t-online.de!grolier!btnet-peer0!btnet!news5-gui.server.ntli.net!ntli.net!news11-gui.server.ntli.net.POSTED!not-for-mail Sender: mjw@golux Newsgroups: comp.lang.ada Subject: Re: Using renaming declarations to make private subprograms visible References: <87itfcnuyj.fsf@chiark.greenend.org.uk> <3B87EDC9.A6D626E8@acm.org> From: Matthew Woodcraft Message-ID: <87heuv6q90.fsf@chiark.greenend.org.uk> User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: 26 Aug 2001 11:59:39 +0100 NNTP-Posting-Host: 213.107.104.73 X-Complaints-To: abuse@ntlworld.com X-Trace: news11-gui.server.ntli.net 998823562 213.107.104.73 (Sun, 26 Aug 2001 11:59:22 BST) NNTP-Posting-Date: Sun, 26 Aug 2001 11:59:22 BST Organization: ntl Cablemodem News Service Xref: archiver1.google.com comp.lang.ada:12427 Date: 2001-08-26T11:59:39+01:00 List-Id: Jeffrey Carter writes: > This compiles with GNAT 3.13p: > > function Convert_To_String (Source : Token_Type) return String > renames To_String; > > function To_String (Source : Token_Type) return String > renames Convert_To_String; Yes, it compiles. I tried this before, but I didn't actually run it: it seems to me that it's just a circular renaming that the compiler doesn't catch (though I'm surprised the compiler isn't required to catch it). At any rate, I've tried now, and the code below doesn't run for me with GNAT 3.13p (segmentation fault, with a stack backtrace containing many thousands of identical entries). As an aside, if I want to use -fstack-check, do I have to recompile the entire runtime? -M- === with Ada.Strings.Unbounded; package Renaming is type Token_Type is private; function To_Token (Source : String) return Token_Type; function To_String (Source : Token_Type) return String; private type Token_Type is new Ada.Strings.Unbounded.Unbounded_String; function To_Token (Source : String) return Token_Type renames To_Unbounded_String; function Convert_To_String (Source : Token_Type) return String renames To_String; function To_String (Source : Token_Type) return String renames Convert_To_String; end Renaming; with Renaming; use Renaming; with Ada.Text_IO; use Ada.Text_IO; procedure Try_Renaming is S : constant String := "Hello World"; T : Token_Type; begin T := To_Token (S); declare New_S : constant String := To_String (T); begin Put (S); Put (New_S); end; end Try_Renaming;