Re: [Vala] how to *not* automagically copy arrays passed to methods?



On Wed, Dec 21, 2011 at 6:18 AM, Matto Marjanovic <maddog mir com> wrote:

Ok, another bonus question (see revised subject) --- and I think this
issue was the root of the misfire with my earlier experiments with slices:

How does one tell valac to *not* copy arrays that are passed to methods?

For example:

  public void foo(uint8[] x) {
    ...
    x[0] = 7;
    ...
  }

The generated C code for the method duplicates the array x before executing
the body of the method; hence the common case of a method which modifies a
buffer, returning with side-effects, doesn't work.


What are you talking about? It's not copied.

-- 
www.debian.org - The Universal Operating System


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]