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: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Storage_Error with parameterized records Date: 1998/07/08 Message-ID: #1/1 X-Deja-AN: 369563430 References: <359D3A0C.13AF4C53@cl.cam.ac.uk> <6nntf2$u2m$1@nnrp1.dejanews.com> X-Complaints-To: usenet@news.nyu.edu X-Trace: news.nyu.edu 899909524 12339 (None) 128.122.140.58 Organization: New York University Newsgroups: comp.lang.ada Date: 1998-07-08T00:00:00+00:00 List-Id: Bob Duff said <<> > type Correlation_Matrix(Last_Line : Natural := 0) is > > record > > Mat : CMatrix(0 .. Last_Line, 0 .. Last_Line); > > end record; > > > > causes the following warnings (and at runtime the promised > > Storage_Error): > > > > warning: Storage_Error will be raised at run-time > > warning: creation of object of this type may raise Storage_Error Perhaps a different wording of the message would make it clearer. The thing is, if you say "X: Correlation_Matrix(Last_Line => 1_000);" it will probably *not* raise Storage_Error. The point is that (1) if you don't constrain it, it will raise S_E, and (2) there's no point in giving a default value unless you want to have some unconstrained objects. If you leave out ":= 0", I would think the warning would go away. But of course you could still get S_E for "Last_Line => 1_000_000_000" on an object decl. >> Yes, of course the warning goes away if you have no default discriminant, and further more the warning is only given if you use a type like Integer (as opposed to Character). As for the message, Bob is probably one of the few people who really is accustomed to calling all types in Ada subtypes :-) :-) When the message says "of this type" it means "of this subtype". I personally find the change in terminology in the Ada 95 RM here confusing, and certainly people do not use it in common usage. Oh well. Certainly we could use subtype in this case I suppose! Or put in the word unconstrained.