IIRC, the stack pointer is part of the operating system, not the C language.
When a subroutine is called, the parameters are pushed to the stack,
and the return value is stored in a specific register.
When a routine creates a variable, the system's memory allocator finds
a new piece of unused memory to use.
If you call a routine (or function) that creates a variable, when the
routine returns, the memory is marked free, but the OS does not clean
the memory, so the contents can still be accessed, until the OS reuses
that memory.
What are you trying to do? Access that memory? Why? Are you trying to
return a reference from a subroutine and access what is referenced?
You can do that. As long as memory is referenced, Perl does not
release it.

Hope this helped!

On Dec 31, 2007 5:43 PM, gst <[EMAIL PROTECTED]> wrote:
> hi,
>
> iirc, in C if I store somwhere a pointer to a "stack" value (e.g.:
> call a function with an auto variable, return its pointer) i know i'm
> going to mess things, since that piece of data will be most probably
> overwritten by subsequent calls.
>
> if I do the same in Perl (with a hard ref), do I have any guarantee
> that the same behavior (implicit aliasing) does - or does not (every
> new scalar is guaranteed to not alias the old non existant value) -
> apply?
>
> thank you in advance
> gst

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to