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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,22dff575e187f5a2 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Passing arrays as record fields Date: 1997/06/13 Message-ID: #1/1 X-Deja-AN: 248273758 References: <33A00D4C.F4E@taz.dra.hmg.gb> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-06-13T00:00:00+00:00 List-Id: In article <33A00D4C.F4E@taz.dra.hmg.gb>, Mark J Gallagher wrote: > type Count_t is Integer range 0 .. Integer'Last; > type Count_a is array (Integer range <>) of Count_t; > type Net_t(... N_Neurons: Count_t ...) is record > ... > Neuron_Counts: Count_a(N_Neurons); > ... > end record; > >and a procedure > > procedure Initialise(Net: in out Net_t); > >I can declare a variable Net of type Net_t and assign an array to the >Neuron_Counts field, which I can read from the block in which Net has >been declared. However, when I attempt to read the array from the >procedure Initialise, I get garbage. Help! A few points: If you just need a "count" type, use the predefined type Natural. Do you want you neural net type to be constrained or unconstrained? That is, should neural net objects be mutable or not? Try this: type Natural_Array is array (Positive range <>) of Natural; subtype Neural_Net_Length_Range is Natural range 0 .. 100; -- or whatever max is appropriate type Neural_Net (Length : Neural_Net_Length_Range := 0) is record Counts : Natural_Array (1 .. Length); end record; I know nothing about neural nets, so you may need to do some more explaining before I totally understand your problem. What is the purpose of Initialize? Does it set the count? Or does it merely read the count specified by the client? The former means the neural net type is mutable, the latter that mutability is optional. And what I mean by mutability is, Is the subtype definate? An indefinate subtype (without a default value for the discriminant) would have to be constrained by the client (unless of course the Initialize subprogram were a function, in which case the subprogram could define the constraint). Tell me more about what Initialize is trying to do, and be more specific about the problems you're having. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271