Skip to content

Wrong empty return in Attributes.R ? #588

@eddelbuettel

Description

@eddelbuettel

@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions