comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <mcqada@earthlink.net>
Subject: Re: Constraint error?
Date: Tue, 05 Jun 2001 12:21:52 GMT
Date: 2001-06-05T12:21:52+00:00	[thread overview]
Message-ID: <3B1CC1FE.304BF00E@earthlink.net> (raw)
In-Reply-To: 60OS6.3835$v4.183613@www.newsranger.com

Ted Dennison wrote:
> 
> 
> The second way to deal with strings is to delay their declaration until you can
> assign the value directly into them. That way you can leave the bounds off of
> the declaration and let it size itself perfectly to the contents. This is the
> easiest method to deal with, if you can use it. Most of the attributes
> ('whatever) that deal with strings can be used with this method. If you want to
> use this method in your own subprograms, you should endevor to always return
> strings as function return values. Of course this method only works if you don't
> plan on changing the contents. For example (my apologies if my newsreader hoses
> the formatting):
> 
> declare
> Width_Answer : constant String := Answer (1..Answer_Length);
> begin
> -- work with Width_Answer in here.
> ..
> end;

Ada 95 removed the requirement that a String declaration as used in the
above example be declared _constant_.  The string will be properly
sized, but you can now modify it to your heart's content, just can't
change the size.

Marc A. Criley
Senior Staff Engineer
Quadrus Corporation
www.quadruscorp.com



  parent reply	other threads:[~2001-06-05 12:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-03 22:30 Constraint error? McDoobie
2001-06-03 23:13 ` David C. Hoos, Sr.
2001-06-03 23:26   ` McDoobie
2001-06-04 15:42     ` Ted Dennison
2001-06-04 16:12       ` Marin David Condic
2001-06-04 20:52         ` Robert A Duff
2001-06-04 20:50       ` Robert A Duff
2001-06-04 21:13         ` Ted Dennison
2001-06-04 21:44           ` Ehud Lamm
2001-06-05 12:21       ` Marc A. Criley [this message]
2001-06-05 15:22         ` Ted Dennison
replies disabled

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