FIAS . Impressum . Privacy

Reference of a Vc vector

Matthias Kretz [please enable javascript to see the address]
Fri Sep 20 11:43:02 CEST 2013


Hello Raman,

On Friday 20 September 2013 14:51:05 Raman Sehgal wrote:
>   I was wondering that if i pass a Vc vector to a function and then do some
> processing on that vector in the function then will reflect the results in
> the calling
> function or  the changes is visibe only in called function i.e. is it  just
> like call by value in C (In that case calling function didn't get the
> modified values) or it will pass references of vector to the
> called function and changes are reflected in called and calling function
> both

The Vc types behave exactly like builtin types in that regard.

I.e.

void f(float_v x) { x += 1.f }
void g(float_v &x) { x += 1.f }

void h() {
 float_v x = 1.f;
 f(x);
 // x is still 1.f
 g(x);
 // x is 2.f
}

Cheers,
	Matthias
-- 
Dipl.-Phys. Matthias Kretz

Web:   http://compeng.uni-frankfurt.de/?mkretz

SIMD easy and portable: http://compeng.uni-frankfurt.de/?vc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://compeng.uni-frankfurt.de/pipermail/vc/attachments/20130920/32f140b9/attachment.pgp>


More information about the Vc mailing list
FIAS . Impressum . Privacy