comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Success: Ada versus C
Date: 1997/06/09
Date: 1997-06-09T00:00:00+00:00	[thread overview]
Message-ID: <dewar.865871475@merv> (raw)
In-Reply-To: 5ngt2t$ei8$2@mdnews.btv.ibm.com


Dale says

<<I'm saying that until you think it through, pass-by-reference seems
faster. Think twice and you see that pass-by-value is faster for
simple values. Pass-by-reference shines on structures, which is
where Ada95 allows it.>>

OK, understood. It is hard for me sometimes to guess what misconceptions
people might have, but yes of course call by value is more efficient
for values that fit in registers. Indeed this is why Fortran does not
require call by reference. A typical Fortran compiler, like a typical
Ada compiler, uses call by value for register sized scalars, and call
by reference for large stuff, and there are some cases in between which
are target dependent (for example, the SPARC ABI (unwisely) requires all
structures to be passed by reference, but many other ABI's permit the
more efficient approach of passing register sized structures by value
in registers -- note that it is particuarly annoying to be forced to
pass structs by reference at the ABI level in C, because C requires
call by value for structs at the language level. This means that a
typical SPARC C compiler that obeys the ABI must first copy a small
struct to memory and then pass its address, instead of just passing
it in a register.





  reply	other threads:[~1997-06-09  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-04  0:00 Success: Ada versus C RC
1997-06-06  0:00 ` Arthur Schwarz
1997-06-06  0:00   ` Dale Pontius
1997-06-07  0:00     ` Robert Dewar
1997-06-09  0:00       ` Dale Pontius
1997-06-09  0:00         ` Robert Dewar [this message]
1997-06-06  0:00   ` Brian Rogoff
1997-06-06  0:00     ` Corey Minyard
1997-06-07  0:00   ` Robert Dewar
1997-06-08  0:00   ` RC
replies disabled

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