Re: [Rd] Question about copying arguments in C.

2012-09-16 Thread Simon Urbanek
On Sep 15, 2012, at 10:50 PM, Simon Knapp wrote: > OK I think I'm getting it, but one more question if I may... > > When I write a function, I don't protect the arguments explicitly (I > understand that they should be protected within the calling function) - are > my functions examples of func

Re: [Rd] Question about copying arguments in C.

2012-09-15 Thread Simon Knapp
OK I think I'm getting it, but one more question if I may... When I write a function, I don't protect the arguments explicitly (I understand that they should be protected within the calling function) - are my functions examples of functions that "protect their arguments"? Looking at the code for s

Re: [Rd] Question about copying arguments in C.

2012-09-15 Thread Simon Urbanek
On Sep 15, 2012, at 2:57 PM, Simon Urbanek wrote: > > On Sep 15, 2012, at 11:28 AM, Simon Knapp wrote: > >> Hi Simon, >> >> Thanks for your advice, but I'm still not clear. In my case I don't >> want to modify the result - the integer acts as a handle for indexing >> an array in later calls ba

Re: [Rd] Question about copying arguments in C.

2012-09-15 Thread Simon Urbanek
On Sep 15, 2012, at 11:28 AM, Simon Knapp wrote: > Hi Simon, > > Thanks for your advice, but I'm still not clear. In my case I don't > want to modify the result - the integer acts as a handle for indexing > an array in later calls back into my library. > > As I understand it, returning result l

Re: [Rd] Question about copying arguments in C.

2012-09-15 Thread Simon Knapp
Hi Simon, Thanks for your advice, but I'm still not clear. In my case I don't want to modify the result - the integer acts as a handle for indexing an array in later calls back into my library. As I understand it, returning result like SEXP func(SEXP arg) {return arg;} would not copy arg and he

Re: [Rd] Question about copying arguments in C.

2012-09-15 Thread Simon Urbanek
On Sep 14, 2012, at 11:10 PM, Simon Knapp wrote: > Hi List, > > I'd imagine this is a question that has been answered before, but I > can't seem to track it down, sorry for the duplication if it has. > > I am writing an interface for a C library and want to return an S4 > class from the 'constr