comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: controlled constant_reference type?
Date: Wed, 14 Mar 2018 17:46:40 -0500
Date: 2018-03-14T17:46:40-05:00	[thread overview]
Message-ID: <p8c8og$ege$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 977b6908-e955-45de-8315-2902f1a1f1c8@googlegroups.com

>"Stephen Leake" <stephen_leake@stephe-leake.org> wrote in message 
>news:977b6908-e955-45de-8315-2902f1a1f1c8@googlegroups.com...
>I'm trying to create a protected vector container, that automatically 
>provides task-safe access.
>
>I'm having trouble with GNAT GPL 2017 not finalizing a read lock object,
>and I'm wondering if this is a compiler error.

It's hard to say without doing a complete debug of your code, and I don't 
have time or energy to do that.

An object of a limited controlled type has pretty canonical semantics, and 
there really aren't many optimizations that can be done (mostly just 
omitting temporary objects).

OTOH, an object of a nonlimited controlled type has rather squishy 
semantics, and there are many allowable optimizations.

However, the basic rule of (aggregates + Initialize calls + Adjust calls) = 
Finalize calls is supposed to be true regardless of what optimizations are 
made or not made.

Still, it's a common programming error to forget that aggregates don't call 
Initialize (the assumption is that they completely initialize the object) or 
to forget to take Adjust into account when assignments (like function 
returns) are involved. So I'd check those first, and if those are properly 
accounted for, then it's most likely a compiler bug.

                                  Randy.



      parent reply	other threads:[~2018-03-14 22:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14  8:55 controlled constant_reference type? Stephen Leake
2018-03-14 10:49 ` Alejandro R. Mosteo
2018-03-14 22:46 ` Randy Brukardt [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox