Function recursion

Does CUDA support call recursion for function? Something like:

struct Node

{

   int i;

   Node *child;

};

void IterateTree ( Node* node )

{

  //do something

  IterateTree(node->child);

}

or is stackless/inlines automatically all the function calls?

thx

Function calls are inlined.

Paulius

No, recursive calls don’t work - it is stackless.

You can use function template recursion if the recursion can be unrolled completely by the preprocessing step (see nvcc -v what happens), ie. if the terminating expression can be computed at compile time.

Peter