[Rd] Suggestion: mkString(NULL) should be NA
Gabriel Becker
gmbecker at ucdavis.edu
Tue May 24 17:59:50 CEST 2016
Shouldn't Rf_mkString(NULL) return (the c-level equivalent of) character()
rather than the NA_character_? An empty string and NULL aren't the same. It
seems reasonable for Rf_mkChar to give NA_character_ though.
~G
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
>
--
Gabriel Becker, PhD
Associate Scientist (Bioinformatics)
Genentech Research
[[alternative HTML version deleted]]
More information about the R-devel
mailing list