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,93123f6108f30530 X-Google-Attributes: gid103376,public From: Laurent Guerby Subject: Re: Yet another efficiency question - To_Lower Date: 1997/07/15 Message-ID: #1/1 X-Deja-AN: 256972269 Sender: guerby@boole.enst-bretagne.fr References: <5pclke$203$1@goanna.cs.rmit.edu.au> <5q4lnk$9m$1@goanna.cs.rmit.edu.au> Organization: ENST de Bretagne, Brest FRANCE Newsgroups: comp.lang.ada Date: 1997-07-15T00:00:00+00:00 List-Id: Dale Stanbrough 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 , Team Ada. "Use the Source, Luke. The Source will be with you, always (GPL)."