Hello,
Suppose I have the function
SEXP foo(){
SEXP s;
PROTECT(s=allocVector(...))

....
UNPROTECT(1);
return(s)
}

y=foo() // foo is a recusrive call

Q: Am i correct in understanding that one does not need to write
PROTECT(y=foo()) ?(and a corresponding unprotect  later on)
since it is the object that is protected , SEXP is an alias for
SEXPREC* and allocVector probably does some memory allocation which
does not get freed
when foo returns.

Thank you for your time
Regards
Saptarshi

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to