This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
Can't seem to allocate new objects on the fly. There is no such things as malloc or new.
I tried to get the pointer from a local variable but it gets killed when leaving the function:
struct test { int i; int j; }; test* createTest() { test o; o.i = 5; o.j = 1; return &o; } void Init() { test *object = createTest(); object->i; // Invalid stack pointer }
If you want to copy an object, you have to do it by hand.
test A = createTest(); test B = A; // This field is not a member of the struct type test *B = A; // Bulk copy not supported.
There is no casting allowed
void *a = createTest(); // No implicit cast allowed void *a = (void *)(createTest()); // Syntax Error: No explicit cast allowed
If returning &o makes it so the stack pointer is invalid, I'm not sure how you'd properly return a pointer without something like malloc.
&o
I see lots of "function" definitions of actual function return types. Is it a general (void *) handle or some special type?
As there is no type casting, you can't use void*.
No dynamic allocation
Can't seem to allocate new objects on the fly. There is no such things as malloc or new.
I tried to get the pointer from a local variable but it gets killed when leaving the function:
No Object Copy
If you want to copy an object, you have to do it by hand.
Casting
There is no casting allowed
If returning
&o
makes it so the stack pointer is invalid, I'm not sure how you'd properly return a pointer without something like malloc.I see lots of "function" definitions of actual function return types. Is it a general (void *) handle or some special type?
As there is no type casting, you can't use void*.