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,903f8471df09a778 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: warning: Storage_Error will be raised at run-time Date: 1997/12/16 Message-ID: #1/1 X-Deja-AN: 298907591 References: <97121608442667@psavax.pwfl.com> X-Complaints-To: usenet@news.nyu.edu X-Trace: news.nyu.edu 882329716 5106 (None) 128.122.140.58 Organization: New York University Newsgroups: comp.lang.ada Date: 1997-12-16T00:00:00+00:00 List-Id: 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).