From: sbelmont700@gmail.com
Subject: Re: Question about library-level functions
Date: Sat, 15 Dec 2012 07:23:46 -0800 (PST)
Date: 2012-12-15T07:23:46-08:00 [thread overview]
Message-ID: <8dcc384f-e9b7-4ade-af74-9cf4532bfbe1@googlegroups.com> (raw)
In-Reply-To: <f7a79646-eb34-42c6-b1df-ccbb8c59437f@googlegroups.com>
On Friday, December 14, 2012 10:38:20 PM UTC-5, ytomino wrote:
>
> function Create return T is
>
> begin
>
> return Result : T := (Ada.Finalization.Limited_Controlled with null record) do
>
> Ada.Text_IO.Put_Line ("Initialize (" & System.Address_Image (Result'Address) & ")");
>
> end return;
>
> end Create;
FWIW, I have run into several occasions where GNAT 2012 extended return statements randomly try to finalize objects erroneously, though usually I end up with a program error ('finalize raised exception'). My feeling is that if you change the above to:
function Create return T is
begin
return (Ada.Finalization.Limited_Controlled with null record);
end Create;
your problem could mysteriously vanish.
-sb
next prev parent reply other threads:[~2012-12-15 15:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-15 3:38 Question about library-level functions ytomino
2012-12-15 9:47 ` AdaMagica
2012-12-15 10:50 ` ytomino
2012-12-15 11:38 ` AdaMagica
2012-12-17 19:49 ` Adam Beneschan
2012-12-18 2:26 ` ytomino
2012-12-15 15:23 ` sbelmont700 [this message]
2012-12-16 6:09 ` ytomino
2012-12-16 9:43 ` Simon Wright
2012-12-16 10:21 ` AdaMagica
2012-12-16 13:07 ` ytomino
2012-12-16 18:31 ` Simon Wright
2012-12-18 3:18 ` ytomino
2012-12-18 0:07 ` Randy Brukardt
2012-12-16 13:34 ` ytomino
2012-12-16 15:54 ` AdaMagica
2012-12-18 0:09 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox