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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ce667ecdc314f22 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-07 13:14:07 PST Newsgroups: comp.lang.ada Path: supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!feed.newsreader.com!uunet!ash.uu.net!world!bobduff From: Robert A Duff Subject: Re: Releasing Aliased Variables Sender: bobduff@world.std.com (Robert A Duff) Message-ID: Date: Wed, 7 Mar 2001 21:12:44 GMT References: <3AA692A8.F1283C27@netscape.net> Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.3/Emacs 19.34 Xref: supernews.google.com comp.lang.ada:5513 Date: 2001-03-07T21:12:44+00:00 List-Id: Byron Kauffman 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