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,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9e5138de1ea5afeb X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-27 03:57:03 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: Christoph Grein Newsgroups: comp.lang.ada Subject: Re: Using controlled types to trace program execution Date: Wed, 27 Feb 2002 12:55:33 +0100 (MET) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1014811022 73161 137.194.161.2 (27 Feb 2002 11:57:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 27 Feb 2002 11:57:02 +0000 (UTC) Return-Path: Content-MD5: 2OHjb5SgZQ23PlyoD2J+cQ== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk X-Reply-To: Christoph Grein List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:20511 Date: 2002-02-27T12:55:33+01:00 Dynamic allocation and deallocation are not necessary: generic Unit_Name: String; package Trace is private X: aliased String := Unit_Name; Follower: T (X'Access); end Trace; > tmoran@acm.org wrote: > > > A combination will do the job. > > You can't pass a string as a discriminant to your controlled type, and if > > you pass an access-to-string type it will be a constant and you won't > > be able to "free" the string. But you can do it with two levels: > > type p is access string; > > type t(msg : access p) is new ada.finalization.limited_controlled with ... > > Then use the generic instantiation as a shorthand for declaring an > > aliased pointer to a new string'("something") followed by a declaration > > of the controlled type with a 'access to that pointer as its parameter. > > Thanks - I hadn't thought about declaring a package - only a variable. > > Nige > _______________________________________________ > comp.lang.ada mailing list > comp.lang.ada@ada.eu.org > http://ada.eu.org/mailman/listinfo/comp.lang.ada