comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Releasing Aliased Variables
Date: Wed, 7 Mar 2001 21:12:44 GMT
Date: 2001-03-07T21:12:44+00:00	[thread overview]
Message-ID: <wccsnkpi8qb.fsf@world.std.com> (raw)
In-Reply-To: 3AA692A8.F1283C27@netscape.net

Byron Kauffman <byronbkauffman@netscape.net> writes:

> I'm having a problem understanding what defining a variable as aliased
> does. Is there a problem with releasing an aliased pointer? Can or
> should you even alias a pointer?

If you declare X to be aliased, then you may say X'Access or
X'Unchecked_Access to create a pointer to it.  This makes the code
easier to understand, because you know that such pointers might exist.

In code-generation terms, it causes X to allocated at an addressable
location (eg, not in a register).  It is unlikely that "aliased"
controls whether X is allocated on the stack versus the heap (but of
course compilers can do what they like).

If Y = X'Access, then make sure you never call Unchecked_Deallocation on
Y.

> I'm declaring all of the directsound objects as aliased, which solved a
> problem I was having creating the objects ( it looked like some very
> large buffers were being created on the stack). What's happening now is
> that the release procedure is bombing down in the Windows code, so
> control never returns.

Sounds like some sort of dangling-pointer problem.  Declaring things
aliased wouldn't directly cause that, but deallocating things at the
wrong time, or twice, or returning X'Unchecked_Access where X is local
could all cause that sort of trouble.

- Bob



  parent reply	other threads:[~2001-03-07 21:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-07 19:57 Releasing Aliased Variables Byron Kauffman
2001-03-07 20:44 ` tmoran
2001-03-07 21:12 ` Robert A Duff [this message]
2001-03-08 13:24   ` Florian Weimer
2001-03-08 14:37     ` Pat Rogers
2001-12-27 12:26       ` Florian Weimer
2001-03-08 14:52     ` Tucker Taft
2001-03-08 16:57     ` Robert A Duff
2001-03-09 15:08       ` Using COM Interfaces (was: Releasing Aliased Variables) Byron Kauffman
2001-03-09 17:01         ` Robert A Duff
2001-03-09 21:08         ` tmoran
2001-03-12 18:45     ` Releasing Aliased Variables Richard Kenner
2001-03-07 21:31 ` Florian Weimer
replies disabled

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