OpenCL function syntax

I want use function (not kernel) like this: (C++)

void doSome(float4 &a, float4 &b)
{
  a.x = ... do something ...
  a.y = ... do something ...
  a.z = ... do something ...
  a.w = ... do something ...
  b = ... do something ...
}

How i may write this on OpenCL?
I try some variants with pointers, search in spec, but i dont find answer.

Unfortunately variable references, like in your example, are not available. You must use pointers:

void doSomething(float4 *a, float4 *b)
{
  *a = ...
  (*b).x = ...
}

Note that you must use asterisk ‘*’ to access pointed data.

The arrow operator ‘->’ is not available for OpenCL data types, but should be for user defined structs and unions:

void doSomething(YourStruct *a)
{
  a->variableInStruct = ...
}

Thanks! That work fine. :slight_smile: