Is there a good rule of thumb for when to write a function that
returns an object (to be assigned to a variable) versus passing the
object pointer to the function to be modified in place?

I'm more familiar with R's function programming style, which i've seen
in Rcpp documents and list examples:

//1
b = fx(a);

whereas traditional C forbids returning vectors and enforces modify-in-place:

//2
fx(a, &b);

Is there compiler magic that makes these two cases equivalent, or
should 2 to be preferred for heavy lifting?

thanks,
Christian Gunning
University of New Mexico
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to