comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: How To Pass Large Object Arguments
Date: Sun, 24 Nov 2013 12:12:46 +0100
Date: 2013-11-24T12:12:46+01:00	[thread overview]
Message-ID: <87k3fyf3yp.fsf@ludovic-brenta.org> (raw)
In-Reply-To: sqadnfc3IfFSNQzPnZ2dnUVZ_jydnZ2d@giganews.com

FritzVonBraun writes:
> I am fairly new to Ada and I am wondering how I should pass large
> parameters to subprograms like arrays or records that contain other
> components like vectors or lists.

You should not pass parameters by copy or by reference; this is the job
of the compiler.  And you should not presume to know better than the
optimizer in the compiler which method is faster.

So, pass parameters "in" or "in out".

> I did a lot of reading but wasnt able to find a definite answer.

The definitive resource is the Ada Reference Manual (i.e. the ISO
standard that defines the language), which is Free, unlike for some
other languages...

http://www.adaic.org/resources/add_content/standards/12rm/html/RM-6-2.html

GNAT normally passes arrays (including Strings) by reference but very
short arrays might be passed by copy in registers, which is *faster*
than by reference.

HTH

-- 
Ludovic Brenta.


  reply	other threads:[~2013-11-24 11:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-24  7:20 How To Pass Large Object Arguments FritzVonBraun
2013-11-24 11:12 ` Ludovic Brenta [this message]
2013-11-24 12:45 ` Peter C. Chapin
2013-11-25 10:59 ` Georg Bauhaus
2013-11-25 11:09 ` AdaMagica
2013-11-25 16:53 ` adambeneschan
2013-11-25 17:05   ` sbelmont700
replies disabled

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