Mike Swaim
Posts: 13
Nickname: swami
Registered: Apr, 2004
|
|
Re: Stack-based's Limitation
|
Posted: Apr 19, 2004 11:08 AM
|
|
> Can anyone explain why a funtion cannot construct any data > structure whose size is not known to the caller on the > stack? > Is it because of the stack structure? Yes. Objects are located contiguously on the stack. If the caller doesn't know how big the object is, it can't know how much space to reserve, can it?
> Is there any > mechanism that languages use to overcome this limitation? Pointers. (Or object references.)
|
|