Re: absolute beginner: perlrefs to stack values

2008-01-02 Thread groups spamtrap
thanks everyone a lot, you cleared up any doubt, *very* insightful have a wonderful happy new year! On Jan 1, 2008 8:36 PM, Chas. Owens [EMAIL PROTECTED] wrote: On Jan 1, 2008 2:32 PM, Chas. Owens [EMAIL PROTECTED] wrote: snip You can deal with this by using the anonymous arrayref

Re: absolute beginner: perlrefs to stack values

2008-01-02 Thread Jenda Krynicky
From: yitzle [EMAIL PROTECTED] 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. Well ... depends. If you want to call a function provided by

absolute beginner: perlrefs to stack values

2008-01-01 Thread gst
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

Re: absolute beginner: perlrefs to stack values

2008-01-01 Thread Tom Phoenix
On Dec 31, 2007 2:43 PM, gst [EMAIL PROTECTED] wrote: 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.

Re: absolute beginner: perlrefs to stack values

2008-01-01 Thread yitzle
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

Re: absolute beginner: perlrefs to stack values

2008-01-01 Thread Chas. Owens
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

Re: absolute beginner: perlrefs to stack values

2008-01-01 Thread Chas. Owens
On Jan 1, 2008 2:12 PM, Chas. Owens [EMAIL PROTECTED] wrote: snip 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? snip Saying

Re: absolute beginner: perlrefs to stack values

2008-01-01 Thread Peter Scott
On Mon, 31 Dec 2007 14:43:44 -0800, gst wrote: 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

Re: absolute beginner: perlrefs to stack values

2008-01-01 Thread Chas. Owens
On Jan 1, 2008 2:32 PM, Chas. Owens [EMAIL PROTECTED] wrote: snip You can deal with this by using the anonymous arrayref generator: snip Oh, the proper term is anonymous array composer (at least according to the 3rd Camel). I knew anonymous arrayref generator sounded wrong. -- To unsubscribe,

Re: absolute beginner: perlrefs to stack values

2008-01-01 Thread Jenda Krynicky
From: gst [EMAIL PROTECTED] 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

Re: absolute beginner: perlrefs to stack values

2008-01-01 Thread Paul Johnson
On Mon, Dec 31, 2007 at 02:43:44PM -0800, gst 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