comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier <gautier.demontmollin@maths.unine.ch>
Subject: Re: A question to the "access-type lifetime rule"
Date: 2000/04/03
Date: 2000-04-03T00:00:00+00:00	[thread overview]
Message-ID: <38E8EA8A.CD3C8134@maths.unine.ch> (raw)
In-Reply-To: 38E89AB9.7D33E88C@hamilton.physik.uni-konstanz.de

Bernd Rinn:

As other replies point out, the generic approach is the best.

  generic
  with function Integrand_Type( X : Long_Float ) return Long_Float;
  function Integrate(Lower_Bound, Upper_Bound: Long_Float) return Long_Float;

Not only for avoiding any bad surprise with pointers, robustness or Ada-style,
but also for efficiency reasons: according to the function you plug in as generic
parameter, the contents of that function will be inlined into the "Integrate"
function, plus optimised by the compiler. Reversely, each reference to a pointer
to a function will be at least an indirection slower than the generic version.

HTH
______________________________________________________
Gautier  --  http://members.xoom.com/gdemont/gsoft.htm




  reply	other threads:[~2000-04-03  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-03  0:00 A question to the "access-type lifetime rule" Bernd Rinn
2000-04-03  0:00 ` Gautier [this message]
2000-04-03  0:00 ` David
2000-04-03  0:00 ` Jean-Marc Bourguet
2000-04-03  0:00 ` Robert Dewar
2000-04-04  0:00 ` John English
replies disabled

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