From: John McCabe <john@nospam.assen.demon.co.uk>
Subject: Re: This MIDI stuff, would someone be interested in reviewing my code?
Date: Wed, 10 Mar 2010 12:29:00 +0000
Date: 2010-03-10T12:29:00+00:00 [thread overview]
Message-ID: <834fp59t66vf2rh9rg11i81j8debod72i4@4ax.com> (raw)
In-Reply-To: uaaugsa5w.fsf@stephe-leake.org
On Wed, 10 Mar 2010 06:12:11 -0500, Stephen Leake
<stephen_leake@stephe-leake.org> wrote:
>John McCabe <john@nospam.assen.demon.co.uk> writes:
>
>>>I had them declared as aliased. With just 'access on it the compiler
>>>said "blah blah blah can't do it because it's not global" (or
>>>something like that). I'll check again, but that was the gist of it.
>>
>> mididevs.adb:56:49: non-local pointer cannot point to local object
>>
>> Note - this is an updated version so the lines aren't the same number!
>>
>> That's with something like:
>>
>> procedure MidiDevs is
>> Midi_In_Caps : aliased Win32.Mmsystem.MIDIINCAPS;
>
>This object is declared in a procedure, and is therefore allocated on
>the stack.
That's right.
>> begin
>> <blah>
>> res := Win32.Mmsystem.midiInGetDevCaps(Device_ID,
>> Midi_In_Caps'Access,
>
>This function takes a parameter of a global access type.
>
>So in theory, the function could store a copy of the pointer, and then
>use it after MidiDevs has returned, and the actual object disappeared.
>
>That's why this is illegal.
Exactly.
>However, if MidiDevs is really your main procedure, then Midi_In_Caps
>will never disappear, and 'Unchecked_Access is safe.
Fair point. Thanks.
next prev parent reply other threads:[~2010-03-10 12:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-08 11:40 This MIDI stuff, would someone be interested in reviewing my code? John McCabe
2010-03-08 11:52 ` Gautier write-only
2010-03-08 12:30 ` John McCabe
2010-03-08 17:24 ` Jeffrey R. Carter
2010-03-09 10:21 ` John McCabe
2010-03-09 12:10 ` Brian Drummond
2010-03-09 12:26 ` John McCabe
2010-03-09 12:42 ` John McCabe
2010-03-10 11:12 ` Stephen Leake
2010-03-10 12:29 ` John McCabe [this message]
2010-03-09 12:24 ` John McCabe
2010-03-09 13:11 ` Martin
2010-03-09 14:00 ` John McCabe
2010-03-13 8:12 ` Christophe Chaumet
2010-03-15 11:35 ` John McCabe
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox