comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: [Q] Returning Strings From A Function
Date: 1997/04/05
Date: 1997-04-05T00:00:00+00:00	[thread overview]
Message-ID: <dewar.860256392@merv> (raw)
In-Reply-To: 19970405130401.IAA25121@ladder01.news.aol.com


John Herro said, talking of the question about dealing with a variable
length string value returned

<<Does anyone have other solutions?
>>

Most certainly! The normal solutoin is just to declare a local variable
and initialize it with the returned value:

   x : string := f(x);

That's straightforward. If you want to use pointers, then you can use

   type x is access all string;

   xv : x;

   xv := new String'(f(x));

These seems straightforward, so I am not quite sure I understand John
Herro's reference to "minor annoyance". In a language designed NOT to
require default heap allocation, the Ada semantics seem quite reasonable.
I also find John's suggested solutions unnecessarily complex (so perhaps
that's why he finds this so annoying :-)






  reply	other threads:[~1997-04-05  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-04  0:00 [Q] Returning Strings From A Function John McCabe
1997-04-04  0:00 ` Joakim Olsson
1997-04-05  0:00 ` johnherro
1997-04-05  0:00   ` Robert Dewar [this message]
1997-04-06  0:00     ` John McCabe
1997-04-06  0:00       ` Robert Dewar
1997-04-05  0:00   ` Mark & Zurima McKinney
1997-04-07  0:00     ` Jon S Anthony
1997-04-07  0:00       ` johnherro
1997-04-07  0:00     ` johnherro
1997-04-07  0:00       ` Robert Dewar
1997-04-08  0:00     ` Jeff Carter
1997-04-09  0:00     ` Looking for an Ada SCIENTIFIC UNITS checking package Ron House
1997-04-05  0:00 ` [Q] Returning Strings From A Function John McCabe
1997-04-05  0:00   ` Robert Dewar
1997-04-06  0:00     ` John McCabe
1997-04-06  0:00       ` Matthew Heaney
1997-04-06  0:00       ` Robert Dewar
1997-04-06  0:00         ` Nick Roberts
1997-04-07  0:00           ` Robert A Duff
1997-04-08  0:00             ` Nick Roberts
1997-04-07  0:00               ` Matthew Heaney
1997-04-05  0:00   ` Robert A Duff
1997-04-06  0:00 ` John McCabe
replies disabled

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