[Rd] Writing R Extensions: clarification/modification request

Thell Fowler tbfowler4 at gmail.com
Tue Mar 18 21:43:16 CET 2014


Hello R-core developers,

The upcoming release of R-3.1.0 is exciting, especially the support
structure changes for c++11!

But, just the other day I encountered an issue with the package
creation tools within Rcpp and Dirk referred me to 'Writing R
Extensions' [footnote 13] along with the comment that `.hpp` file
extensions are "verboten" on CRAN and then proceeded to find packages
with `.hpp` files in CRAN.

Hopefully you can provide some clarification as to the reasoning of
current stance on this as the documentation doesn't provide any
direction. Research indicates that the footnote may no longer reflect
the current state of R or CRAN and that it may be time to _remove the
statement from the documentation rather than punting and editing to
reflect `c++11`_.

Knowing that the time to manage the upcoming release schedule and the
changes to CRAN is more than likely keeping you to busy to research a
seemingly insignificant edge case I apologize for the length of this
message. Hopefully my time in gathering this supporting information
will save yours.

__Research Notes__

The footnote pertains to section 1.1.5 [Package-subdirectories]
paragraph 8 where it states

>  We recommend using .h for headers, also for C++ or Fortran 9x include files.
>  footnote: Using .hpp is not guaranteed to be portable.

This statement and accompanying footnote are modifications of the
original by Kurt Hornick in rev at 40010 on Nov. 26 2006.

>  We recommend using .h for headers, also for C++
> footnote: Using .hpp, although somewhat popular, is not guaranteed to be portable.

It is completely understandable that this stance was taken, at that
time, since tool-chains hadn't considered `.hpp` as a standard
extension for c++ (none of the then released GCC g++ compilers (3.4.6,
4.0.3, 4.1.1) made any official distinction for it).  As the original
commit indicates though, the it was common. So common in fact that a
[hpp-patch] was filed in 2004 to address this.

The `.hpp` extension became a first-class c++ extension when the
hpp-patch was _finally_ applied in Aug. 2007 and so for GCC >= 4.2.2
it was standard. LLVM had a [clang patch] in their code base to
recognize `.hpp` for its frontend options in 2009, so LLVM >= 2.7,
meaning that releases of XCode >= 3.2.6 can consider `.hpp` an
officially supported extension.  XCode 3.2.6 goes back to OS X 10.6.

According to R Administration and Installation [Installing R under OS X]:

>  ..., then download the file R-3.2.0.pkg and install it. This runs on OS X 10.6 and later (Snow Leopard, Lion, Mountain Lion, Mavericks, ...); it is a 64-bit ('x86_64') build which should run on all Macs from mid-2008 on.

The above would still hold true for all Macs with _updated_ XCode utilities.

---

Obviously GCC, LLVM, and XCode do not represent the extent of the R
user base but hopefully the fact that these tools and many others (
linkers, autoconf tools, etc...) have recognized, as you are doing
with R-3.1.0 and c++11 support, that times have changed and the people
have set the groundwork for best-practice and standards.


-- 
Sincerely,
Thell

[footnote 13]: http://cran.r-project.org/doc/manuals/r-devel/R-exts.html#FOOT13
[Package-subdirectories]:
http://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Package-subdirectories
[rev at 40010]: https://github.com/wch/r-source/commit/cc84426f5b665fb0cba9945c4726348307f36831
[hpp-patch]: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13676
[clang patch]: https://github.com/llvm-mirror/clang/commit/2059d992cf87caaa6e1790afacdfdf6a26eb57e1
[Installing R under OS X]:
http://r.research.att.com/man/R-admin.html#Installing-R-under-OS-X



More information about the R-devel mailing list