3

I'm writing an R package making use of Rcpp to call functions written in C++ into the R code. Some of these functions and templates are written in files with a .hpp extension following the convention used by boost (and also discussed here).

This does not result in an error when building (R CMD build .) and checking (R CMD check --as-cran package.tar.gz) the package, but it returns the next warning:

Subdirectory ‘src’ contains:
  file.hpp example.hpp
These are unlikely file names for src files

Ok, this is not a big issue, but my concern is, why the warning? is naming *hpp files considered a bad practice in the R community? Are there objective or community reasons why I should use *cpp/*h files instead of *hpp for the templates?

elcortegano
  • 2,444
  • 11
  • 40
  • 58
  • 2
    It is a warning issued by _R_ so you are asking the wrong people here in the `rcpp` tag: go and ask R Core, and/or (re-)read [Writing R Extensions](https://cran.r-project.org/doc/manuals/r-release/R-exts.html) which details all there is to know about R extension packages. – Dirk Eddelbuettel Sep 01 '20 at 16:06

1 Answers1

7

I originally left this information as a comment, but realized it actually answers your question I think, so here goes:

As Dirk Eddelbuettel points out in the comments, when you have a question about an R Core Team policy on R extension packages, your best bet is to look through their excellent Writing R Extensions manual. This manual tells you almost anything you could ever need to know.

In your case specifically, you needed to look at Section 1.1.5, which explains that "[the R Core Team] recommend[s] using .h for headers" because (as they explain in footnote 18) "Using .hpp is not guaranteed to be portable."

duckmayr
  • 16,303
  • 3
  • 35
  • 53