[Sidefx-houdini-list] array elements referring in VEX

Olex P hoknamahn at gmail.com
Tue Aug 24 06:15:26 EDT 2010


Hi Szymon,

I believe there is nothing like a C pointer in VEX, so even if you can pass
one element of array and give it's value to other variable like this:

<code>

void userf(float a) {  float b = a; }

surface test()
{

  float test[] = {0,0,0};
  userf(test[0]);
  printf("%f", test);
}

</code>

you still need an indexing operation in order to modify an element of array.


On Tue, Aug 24, 2010 at 10:57 AM, Szymon Kapeniak <szymon.kapeniak at gmail.com
> wrote:

> hello,
> me or vex can't handle referencing array's element as user function's
> variable. Is it my mistake (hopefully), or in fact a current
> limitation (rsl seems to work this way)?
>
> <code>
>
> void userf(float a) {  a = 1.0; }
>
> surface test()
> {
>
>   float test[] = {0,0,0};
>   userf(test[0]);
>   printf("%f", test);
> }
>
> </code>
>
> if userf() is changed to accept w whole array, this of course works:
>
> void userf(float a[]) { a[0] = 1.0; }
>
>
> thanks for any comments!
> skk.
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



More information about the Sidefx-houdini-list mailing list