[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simple question
>If you use something like pen-state that returns a record inside an rlet
>form, and you assign the PenPat field of a the record to another variable
>and return it, are you left with a dangling pointer when the rlet is
>exited. I.e. when the PenState record is cleaned up, are its fields
>disposed of as well?
Yes. Think about it... rlet expands into a %stack-block which just
allocates the right amount of memory for the object you wanted to bind
on the stack. When the %stack-block exits (i.e., when the rlet exits),
Your pointer is no longer valid, since someone else could use (and
probably already has used) the stack at any time.