Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Spring cleaning" of some ancient pre-processor directives #1363

Closed
eddelbuettel opened this issue Mar 13, 2025 · 9 comments
Closed

"Spring cleaning" of some ancient pre-processor directives #1363

eddelbuettel opened this issue Mar 13, 2025 · 9 comments

Comments

@eddelbuettel
Copy link
Member

Include file inst/include/Rcpp/platform/compiler.h contains a number of ancient tests ("is gcc newer than 4.5 ?") that we should be able to simplify. One approach may be to open a branch and to chip away carefully, building on last year's variadic templates cleanup. I suspect we can get rid of most if not even all these 'else' branches as current Rcpp versions are very unlikely to encounter a compiler than does not have a minimal C++11 fallback.

For example, RCPP_USING_CXX0X_OR_LATER is defined there, but used only in one file (inst/include/Rcpp/sugar/functions/sapply.h) where it provides a fallback for typedef typename via local pre-C++11 implementation. That else case can likely be removed. By going carefully we may be able to get some simplifications in.

Thoughts?

@Enchufa2
Copy link
Member

Definitely. +1

@eddelbuettel
Copy link
Member Author

eddelbuettel commented Mar 14, 2025

Should we be able to insist on 'C++11 or newer' ? It is a large enough watershed that it could lead to more cleanup. (Still noodling in platform/compiler.h after a few so-far-local-only tests.) Is there conceivably anything at CRAN insisting on C++ older than C++11? Non-CRAN builds can always be "cordially invited" to use an older Rcpp release...

@Enchufa2
Copy link
Member

Enchufa2 commented Mar 14, 2025

R does not support C++98 anymore (since v4.0.0). If you request it, R throws an error. So everything on CRAN compiles with at least C++11. I think it's safe to remove any older bits.

@eddelbuettel
Copy link
Member Author

Yep that is what I thought. I started slowly (as I accidentally removed one line too many at the start) and carefully but now added an actual error if it is not at C++11. Stating that as a baseline will make future incremental commits easier.

First commit coming in a minute. Maybe keep an eye on them and eyeball as I go along.

@eddelbuettel
Copy link
Member Author

"Because we can" our CI matrix go further back than R 4.0.0 so that version is actually now our baseline provided C++11 is opted into but of course as needed we can also remove some of the older checks. Will learn more about that as we go along.

@eddelbuettel
Copy link
Member Author

eddelbuettel commented Mar 14, 2025

🙄 Well that didn't work out. Bails well into the 4.* series.

PS I was too optimistic about __has_feature() but I can just #define given the changed baseline.

@kevinushey
Copy link
Contributor

This sounds good to me. Maybe to make part of Rcpp 1.1.0, with C++11 now being the minimum supported standard? I'd love to tear out all of that generated code bloat.

@eddelbuettel
Copy link
Member Author

That's the plan!

@eddelbuettel
Copy link
Member Author

Rev.dep checks panned out fine so #1364 closes this -- and #1365 carries torch forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants