On 24 May 2011 at 17:29, Christoph Bergmeir wrote:
| Hi,
| 
| of course it's your decision, but I personally think that adding the check to 
the wrapper is a good idea. For now, I added the check everywhere in my code 
where I use a const char* with Rcpp::wrap.

Please try SVN revision 3030 which is now resilient to this particular case
of NULL:

edd@max:~$ r -p /tmp/nil.r 
Loading required package: inline
Loading required package: methods
NULL
Bye
edd@max:~$ cat /tmp/nil.r 
require(inline)

fun <- cxxfunction(signature(),plugin="Rcpp",body='
  const char *ret = NULL;
  return Rcpp::wrap(ret);
');

fun()
cat("Bye\n")
edd@max:~$ 

As I joked earlier, it won't help the next time NULL comes hiding as the
payload of another pointer, but at least const char* is now covered. I also
added two quick unit tests.

Thanks for alerting us to this. Segfaults are after all almost always bad.

Dirk 

-- 
Gauss once played himself in a zero-sum game and won $50.
                      -- #11 at http://www.gaussfacts.com
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to