> WM> Variables on the stack does not consume time. Only if something has to
> WM> be initialized or so, like for example a long string.

> I  am not sure that is consume no time. If I remember well, local vars
> are  dynamicaly  allocated  and  deallocated each time you go into the
> procedure,  so  it take a bit (not much) to allocate/deallocate it and
> finally you may produce more memory fragmentation.

Defenitely not. Wilfried is perfectly correct. Allocating only one or one 
hundred local variables takes exactly the same time, just the time to add a 
constant (computed at compile time) to the stack pointer. It doesn't 
fragment memory at all since the local variables are allocated on the stack 
and not on the heap managed by the memory allocator.

The only problem with local variable, is that data must be copied elsewhere 
if it has to persist for some time after the function returns. And that 
takes a lot of time (I mean copy data) when data is a large buffer.

--
[EMAIL PROTECTED]
http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to