Wrong empty return in Attributes.R ? #588

Closed
eddelbuettel opened this Issue Nov 13, 2016 · 0 comments

Projects

None yet

1 participant

@eddelbuettel
Member
eddelbuettel commented Nov 13, 2016 edited

@dmurdoch just sent a mass email to maintainers:

To maintainers of a number of CRAN packages:

I just did a search through CRAN source code for possible problems in the use
of return() in R packages. Unlike C, in R return() is a function; if you have
code like

if (condition) return;

the function won't be called, so execution will continue to the next line.

Your packages appear to have some instances of that usage, shown below. Some
of these may be false positives (e.g. you used "return" as a local variable
name), but I think most of them are bugs. Please take a look,
and if changes are needed, submit a revised version to CRAN.

and further down has this snippet:

./Rcpp/R/Attributes.R : 620 if (is.null(value) || !nzchar(value))
./Rcpp/R/Attributes.R : 621 return;

I think he got us. The full segment is here and I think we should indeed make that return(NULL).

PR coming in a moment.

@jjallaire jjallaire closed this in 3898e26 Nov 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment