[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: avoiding copying arguments by value when calling a function
From: |
Sergei Steshenko |
Subject: |
Re: avoiding copying arguments by value when calling a function |
Date: |
Tue, 21 Aug 2012 03:55:25 -0700 (PDT) |
--- On Mon, 8/20/12, Jordi Gutiérrez Hermoso <address@hidden> wrote:
> From: Jordi Gutiérrez Hermoso <address@hidden>
> Subject: Re: avoiding copying arguments by value when calling a function
> To: "Sergei Steshenko" <address@hidden>
> Cc: "Carnë Draug" <address@hidden>, address@hidden
> Date: Monday, August 20, 2012, 7:29 AM
> On 20 August 2012 10:25, Sergei
> Steshenko <address@hidden>
> wrote:
> > On Mon, 8/20/12, Carnë Draug <address@hidden>
> wrote:
> >> On 20 August 2012 14:55, Sergei Steshenko <address@hidden>
> >> wrote:
> > [snip]
> >> Seems the manual
> >> http://www.gnu.org/software/octave/doc/interpreter/Call-by-Value.html
> >> is incorrect.
> > [snip]
> >> Carnë
> >>
> >
> > FTM: "each argument in a function call is evaluated and
> assigned to
> > a temporary location in memory before being passed to
> the function."
> >
> > well, in the light of given explanations indeed
> incorrect. i.e. bug
> > in documentation.
>
> COWs look like pass by value if you ignore memory
> allocation. From the
> user's point of view, a COW *is* pass by value. COWs are
> supposed to
> be a transparent optimisation. This is why the manual
> further down
> says,
>
> Even though Octave uses pass-by-value
> semantics for function
> arguments, values are not copied
> unnecessarily.
>
> I don't think there is a documentation bug.
>
> - Jordi G. H.
>
"if you ignore memory allocation" - does memory allocation happen ?
If yes, is it ultimately a system call ('malloc', etc.) ?
If yes, then it slows down execution - because of the system call.
Thanks,
Sergei.
- avoiding copying arguments by value when calling a function, Sergei Steshenko, 2012/08/20
- Re: avoiding copying arguments by value when calling a function, Michael Goffioul, 2012/08/20
- Re: avoiding copying arguments by value when calling a function, c., 2012/08/20
- Re: avoiding copying arguments by value when calling a function, Sergei Steshenko, 2012/08/20
- Re: avoiding copying arguments by value when calling a function, Jordi Gutiérrez Hermoso, 2012/08/20
- Re: avoiding copying arguments by value when calling a function, Carnë Draug, 2012/08/20
- Re: avoiding copying arguments by value when calling a function, Sergei Steshenko, 2012/08/22