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,19bd7ab0daefd69b X-Google-Attributes: gid103376,public From: Pascal MALAISE Subject: Re: Storage_Error with parameterized records Date: 1998/07/04 Message-ID: <359D5900.3CC0D569@magic.fr>#1/1 X-Deja-AN: 369025203 Content-Transfer-Encoding: 7bit References: <359D3A0C.13AF4C53@cl.cam.ac.uk> Mime-Version: 1.0 NNTP-Posting-Date: 3 Jul 1998 22:19:44 GMT Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@ulysse.magic.fr X-Trace: ulysse.magic.fr 899504384 4502 127.0.0.1 (3 Jul 1998 22:19:44 GMT) Organization: Magic On Line Newsgroups: comp.lang.ada Date: 1998-07-03T22:19:44+00:00 List-Id: Let's take the place of the compiler. > type CMatrix is > array (Natural range <>, Natural range <>) of ... You want un unconstrained mattrix, fair enough, each dimention between 0 and integer'last. So far, it's just a type. So far so good. > type Correlation_Matrix(Last_Line : Natural := 0) is > record > Mat : CMatrix(0 .. Last_Line, 0 .. Last_Line); > end record; It's just a type. No problem so far. I think you get the compiler warning (and the exception) when you declare an object of type Correlation_Matrix. You want a mutant object containing the mattrix. The rule is (often), in order to allow you to "mute" your object's last_line from 0 to integer'last, to allocate the maximum size -> integer'last * integer'last floats! So, when you use mutants, use a "reasonable" subtype. subtype Correlation_Coefficient is Float; subtype Reasonable_Range is Natural range 0 .. 100; type CMatrix is array (Reasonable_Range range <>, Reasonable_Range range <>) of Correlation_Coefficient; type Correlation_Matrix(Last_Line : Reasonable_Range := 0) is record Mat : CMatrix(0 .. Last_Line, 0 .. Last_Line); end record; Then, when you declare the object, the compiler allocates 100*100 floats. You can be thankfull to your the compiler for warning you at compile time. Not all of the do so :-) -- Pascal MALAISE | E-mail: 22 Avenue de CHOISY | (priv) malaise@magic.fr 75013 PARIS | (prof) malaise@fr.airsysatm.thomson-csf.com FRANCE