comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: warning: Storage_Error will be raised at run-time
Date: 1997/12/16
Date: 1997-12-16T00:00:00+00:00	[thread overview]
Message-ID: <dewar.882329534@merv> (raw)
In-Reply-To: 97121608442667@psavax.pwfl.com


Marin says

<<    I think that was kind of what I was shooting at: I may need one
    object with 5 characters in it and another object with a thousand.
    If that means that all objects of the type have to allocate a
    thousand bytes, then it seems like you loose any advantage of
    having a discriminant - just allocate the string to be a thousand
    bytes long from the get-go. The DEC Ada compiler at least gives
    the appearance of doing what I'm looking for in this case - at
    least it never issued any warnings about Storage_Error.
>>

I guess ignorance is bliss :-)
GNAT and DEC Ada 83 have exactly the same implementation model here. You may
not get warnings about SE from DEC Ada 83, but you will certainly get the
SE if you do not use an explicit discriminant!

(in the case we are talking about)

<<    Is there any way to coerce the compiler into the behavior I want?
    (Allocating what I request off of the stack?)
>>

Well if you want an individual variable to be a particular size, then
just constrain it appropriately, and the proper amount of space will
be allocated, but if you want to be free to reassign different lengths,
then it is of coruse NOT possible to assign the space from the stack 
(think about it for a bit, and I think you will see that the only way
to do this is to have hidden implicit heap allocation).






  reply	other threads:[~1997-12-16  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-16  0:00 warning: Storage_Error will be raised at run-time Marin David Condic, 561.796.8997, M/S 731-96
1997-12-16  0:00 ` Robert Dewar [this message]
1997-12-16  0:00 ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
1997-12-15  0:00 Marin David Condic, 561.796.8997, M/S 731-96
1997-12-15  0:00 ` Robert Dewar
1997-12-15  0:00 ` Tucker Taft
replies disabled

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