How to pass movable pointer arguments
version
1.1.1
scope
Example.
This code is provided as example code for a user to base their code on.
description
How to pass movable pointer arguments
boards
Unless otherwise specified, this example runs on the SliceKIT Core Board, but can easily be run on any XMOS device by using a different XN file.
Movable pointers can be passed to arguments marked movable using the move operator. However, they can also be passed to other kinds of pointer arguments but if the movable pointer is a global then you cannot reference it within the called function:
int i = 32; int * movable y = &i; void func1(int * x) { printintln(*x); // Cannot reference y here } void func2() { func1(y); } int main() { func2(); return 0; }