Re: [R] `UNPROTECT' and `return'

2003-02-12 Thread ripley
This _is_ covered in `Writing R Extensions'. What is unsafe is to allow a gc to occur. On Wed, 12 Feb 2003, Timur Elzhov wrote: > In all R functions written in C one must unprotect > result before returning them: > > { > ... > UNPROTECT(1) /* unprotecting `ans' */ > > ret

[R] `UNPROTECT' and `return'

2003-02-12 Thread Timur Elzhov
Dear R experts, In all R functions written in C one must unprotect result before returning them: { ... UNPROTECT(1) /* unprotecting `ans' */ return ans; } Why does one shure that memory occupied by `ans' won't be used by R immediately after unprotecting? Ok, is the next