comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Storage_Error with parameterized records
Date: 1998/07/08
Date: 1998-07-08T00:00:00+00:00	[thread overview]
Message-ID: <dewar.899909372@merv> (raw)
In-Reply-To: wcciul96pgw.fsf@world.std.com

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.





  reply	other threads:[~1998-07-08  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-03  0:00 Storage_Error with parameterized records Markus Kuhn
1998-07-04  0:00 ` Pascal MALAISE
1998-07-05  0:00 ` david.c.hoos.sr
1998-07-08  0:00   ` Robert A Duff
1998-07-08  0:00     ` Robert Dewar [this message]
     [not found] ` <dewar.899586342@merv>
     [not found]   ` <359F50D9.5126DEE1@cl.cam.ac.uk>
1998-07-07  0:00     ` Robert Dewar
1998-07-10  0:00 ` Samuel Mize
1998-07-13  0:00   ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox