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.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,169e98abc3044764 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-02 00:05:55 PST Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!newsfeed.stueberl.de!proxad.net!feeder2-1.proxad.net!news3-1.free.fr!not-for-mail From: "Alex Xela" Newsgroups: comp.lang.ada References: <3f7b24f4$0$28894$626a54ce@news.free.fr> Subject: Re: Question on controlled types Date: Thu, 2 Oct 2003 09:09:20 +0200 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 Message-ID: <3f7bce52$0$2777$626a54ce@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 02 Oct 2003 09:05:54 MEST NNTP-Posting-Host: 81.56.190.34 X-Trace: 1065078354 news3-1.free.fr 2777 81.56.190.34:1382 X-Complaints-To: abuse@proxad.net Xref: archiver1.google.com comp.lang.ada:97 Date: 2003-10-02T09:05:54+02:00 List-Id: Thanks, it is what I was expecting (where did you find the answer, in the RM95?). The example below is trying to synthesize your answer: -------------------------------------------------- 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 := ( Ada.Finalization.Controlled with A=>0);--nothing : OK --J : Instrum.Instrum_Type; --raised PROGRAM_ERROR : access before elaboration : OK end Instrum; -------------------------------------------------- with Instrum, Ada.Finalization,Ada.Text_Io; procedure Test_Instrum is I : Instrum.Instrum_Type := Instrum.J; --adjust : OK --I : Instrum.Instrum_Type := ( ada.finalization.controlled with A=>0); --nothing : OK --I : Instrum.Instrum_Type; --initialize : OK begin Ada.Text_Io.Put_line("end;"); end Test_Instrum; "Matthew Heaney" a �crit dans le message de news: u8yo4imig.fsf@earthlink.net... > "Alex Xela" writes: > > > 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! > > Aggregate assignment is handled specially. For a controlled type, it > means the object must be built in place. > > Clearly, no controlled operations can be called, because they haven't > been elaboratated yet. Hence the special rule for aggregate assignment. > > > >