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.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,169e98abc3044764 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-01 13:06:18 PST Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.stueberl.de!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "Beard, Frank Randolph CIV" Newsgroups: comp.lang.ada Subject: RE: Question on controlled types Date: Wed, 1 Oct 2003 16:03:37 -0400 Organization: Cuivre, Argent, Or Message-ID: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: melchior.cuivre.fr.eu.org 1065038677 80669 80.67.180.195 (1 Oct 2003 20:04:37 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Wed, 1 Oct 2003 20:04:37 +0000 (UTC) To: "Alex Xela" , Return-Path: X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Question on controlled types Thread-Index: AcOIUJY+2f5et4oHRkeYvPF3AaExRQABUEpQ X-OriginalArrivalTime: 01 Oct 2003 20:03:37.0930 (UTC) FILETIME=[1A2E9AA0:01C38857] X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:80 Date: 2003-10-01T16:03:37-04:00 Well, not exactly nothing. It initializes J. In this case, A gets set to 0 (zero). The version that causes PROGRAM_ERROR happens because the Initialize method is called before it has been elaborated. IIRC, basically the differences are: --+ Initialize without calling the Initialize procedure. J : Instrum.Instrum_Type :=3D (Ada.Finalization.Controlled with A=3D>0); --+ Call the Initialize procedure. J : Instrum.Instrum_Type; --+ Call Finalize for J, copy X, then call Adjust for J. J :=3D X; Frank -----Original Message----- From: Alex Xela [mailto:xela2@free.fr] On the following code, what should happen during J variable elaboration? - Nothing - A call to Adjust. I tried to find the answer in RM95 but in vain. My tests on several compilers (and my feeling) were suggesting : = nothing! --CODE : begin = ---------------------------------------------------------------------- ------------------ with Ada.Finalization; package Instrum is type Instrum_Type is new Ada.Finalization.Controlled with record A : Integer; end record; procedure Finalize (O : in out Instrum_Type); procedure Adjust (O : in out Instrum_Type); procedure Initialize (O : in out Instrum_Type); J : Instrum.Instrum_Type :=3D ( Ada.Finalization.Controlled with A=3D>0);--nothing? --J : Instrum.Instrum_Type; --raised PROGRAM_ERROR : access before elaboration end Instrum; --CODE : end = ------------------------------------------------------------------------ ------------------