[A89] Re: A problem


[Prev][Next][Index][Thread]

[A89] Re: A problem




At 06:19 2001-03-21, you wrote:
>Instead, dynamic arrays must use storage space from the heap, not the stack.
>But the C compiler doesn't know how to use the heap itself (unlike in C++,
>which has keywords such as new and delete), so the stack space must be
>reserved via system calls.  In C, this is typically one of malloc, calloc,
>etc.  TI has its own heap functions in ROM, but using TIGCCLIB you can use
>the standard malloc.

Not entirely true. alloca() allocates space on the stack. It is a good idea 
to use this for moderatly sized dynamic arrays, since it is fast and 
doesn't take up any heap space.
I have a feeling not many people now about alloca() and uses malloc() when 
it actually isn't needed, wich makes the program needing more free memory 
to be run, and a bit larger.

///Olle





References: