OK, I understand how it works for using NS classes and even CF objects. What I'm not so sure of is ordinary C-style arrays.
a) can we use malloc/free (in a Cocoa/Cocoa Touch application), or does all memory reservation *have* to come from the various frameworks?
b) I surprised myself the other day by declaring what looks like a static sized array, but where the static length was actually a variable: (As far as I know, the following array declaration isn't legal in ANSI C)
- (void)doSomethingUsing
int)size
{
int myArray[size][size+1];
// stuff
}
The above code fragment seems to work with no problems. Where is this memory coming from? It can't really be statically reserved at compile time, since "size" isn't known. But I'm also not allocating any memory here either.
a) can we use malloc/free (in a Cocoa/Cocoa Touch application), or does all memory reservation *have* to come from the various frameworks?
b) I surprised myself the other day by declaring what looks like a static sized array, but where the static length was actually a variable: (As far as I know, the following array declaration isn't legal in ANSI C)
- (void)doSomethingUsing
{
int myArray[size][size+1];
// stuff
}
The above code fragment seems to work with no problems. Where is this memory coming from? It can't really be statically reserved at compile time, since "size" isn't known. But I'm also not allocating any memory here either.