comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Drummond <brian_drummond@btconnect.com>
Subject: Re: This MIDI stuff, would someone be interested in reviewing my code?
Date: Tue, 09 Mar 2010 12:10:16 +0000
Date: 2010-03-09T12:10:16+00:00	[thread overview]
Message-ID: <avdcp5heupnjjk92sq2singsrdm9l5510s@4ax.com> (raw)
In-Reply-To: cq7cp5508bmai028m6ki1bqh889lkpq9bo@4ax.com

On Tue, 09 Mar 2010 10:21:00 +0000, John McCabe <john@nospam.assen.demon.co.uk>
wrote:

>On Mon, 08 Mar 2010 10:24:26 -0700, "Jeffrey R. Carter"
><spam.jrcarter.not@spam.acm.org> wrote:

>>I would make Numinputdevices and Numoutputdevices constants.
>
>They're not constants though - they're discovered from the
>midiInGetNumDevs and midiOutGetnumDevs functions.

But you can call those functions in an initialisation clause on the declaration.
Then they remain constant within the begin..end section, so you can declare them
as constants.

>>For this small 
>>example, I would do the same with Midiincaps and Midioutcaps;

>The point of allocating/freeing them was to get round the fact that,
>when they were declared in the declarative part of the main function,
>I seemed to have to use 'Unchecked_Access when passing them to
>midiInGetDevCaps/midiOutGetDevCaps.

Look into the "aliased" keyword. Unlike C, the compiler will assume a local
variable is never aliased (and can be optimised) - unless you declare it
aliased, to say there may be a pointer to it. Declare them aliased and you
shouldn't need Unchecked_Access.

- Brian



  reply	other threads:[~2010-03-09 12:10 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 [this message]
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
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