comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent Guerby <Laurent.Guerby@enst-bretagne.fr>
Subject: Re: Yet another efficiency question - To_Lower
Date: 1997/07/15
Date: 1997-07-15T00:00:00+00:00	[thread overview]
Message-ID: <fx2050hhl0.fsf@boole.enst-bretagne.fr> (raw)
In-Reply-To: 5q4lnk$9m$1@goanna.cs.rmit.edu.au


Dale Stanbrough <dale@goanna.cs.rmit.EDU.AU> writes:
> Robert Dewar writes:
> "Indeed, functions returning variable length results will alwqays be less
>  efficient than operating in place on an in out fixed length parameter
>  (fixed length for a particular call)."
> 
> The Ada model for constructors is to have functions returning values.
> The logical implication then is that this is less efficient than the
> C++ in situ constructor model, no?

   I don't think C++ has function variable-length results, so you can
say it's more efficient in C++ if you want ;-).  C++ variable length
data structure must go to the heap (thus using the very efficient
malloc/free stuff, whereas in Ada they can also be on the stack (BTW,
goodbye memory management nightmares).

   Also note that for many kind of constructors, you may be able to
use Ada discriminated types (thus avoiding the need for any
constructor).


-- 
Laurent Guerby <guerby@gnat.com>, Team Ada.
   "Use the Source, Luke. The Source will be with you, always (GPL)."




      parent reply	other threads:[~1997-07-15  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-02  0:00 Yet another efficiency question - To_Lower Dale Stanbrough
1997-07-03  0:00 ` Matthew Heaney
1997-07-04  0:00 ` Robert Dewar
1997-07-11  0:00 ` Dale Stanbrough
1997-07-11  0:00   ` Matthew Heaney
1997-07-15  0:00   ` Laurent Guerby [this message]
replies disabled

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