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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,5d6e2ad0b6f4137a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 09 Mar 2010 06:06:36 -0600 From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: This MIDI stuff, would someone be interested in reviewing my code? Date: Tue, 09 Mar 2010 12:10:16 +0000 Reply-To: brian@shapes.demon.co.uk Message-ID: References: X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-5sGrhkTFyCGete3SmIl4mELbf+/Xvm5E4FC1XYzvatry2CWkyWZLqAPhVLcbINkcpu7FYQ5OXkIgrQn!2fdFzI+/r/2l0FkM45PBYoQ/EzBrE8JHLoVGH/QWLRa32eKaHHLSXhJZFzdxNVVW2Vu49vh+ZuRf!4w== X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Xref: g2news1.google.com comp.lang.ada:9483 Date: 2010-03-09T12:10:16+00:00 List-Id: On Tue, 09 Mar 2010 10:21:00 +0000, John McCabe wrote: >On Mon, 08 Mar 2010 10:24:26 -0700, "Jeffrey R. Carter" > 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