[Rd] Suggestion: mkString(NULL) should be NA
William Dunlap
wdunlap at tibco.com
Tue May 24 18:14:42 CEST 2016
Why should Rf_mkString(NULL) produce NA_STRING instead of ""
(R_BlankString)? I prefer that passing in a nil pointer would cause
an error instead, as the nil may arise by accident, perhaps a pointer
to freed memory, and I would like to be notified that my code is bad instead
of getting a random NA_STRING.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, May 24, 2016 at 8:42 AM, Jeroen Ooms <jeroen.ooms at stat.ucla.edu>
wrote:
> On Thu, May 12, 2016 at 1:20 PM, Jeroen Ooms <jeroen.ooms at stat.ucla.edu>
> wrote:
> > I would like to propose that Rf_mkString(NULL) and Rf_mkChar(NULL)
> > return NA rather than segfault.
>
> An example implementation: https://git.io/vroxm
>
> With this patch, mkChar(NULL), mkCharCE(NULL, ce) would return
> NA_STRING rather than segfault at strlen(NULL). This automatically
> fixes mkString(NULL) as well which wraps mkChar (See Rinlinedfuns.h).
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
[[alternative HTML version deleted]]
More information about the R-devel
mailing list