← 输入框|github.com|刷新
Skip to content

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

Closed

Description

@eddelbuettel

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?

Activity

  1. Enchufa2 commented on Mar 14, 2025

    @Enchufa2
    Member

    Definitely. +1

  2. eddelbuettel commented on Mar 14, 2025

    @eddelbuettel
    MemberAuthor

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

  3. Enchufa2 commented on Mar 14, 2025

    @Enchufa2
    Member

    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.

  4. eddelbuettel commented on Mar 14, 2025

    @eddelbuettel
    MemberAuthor

    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.

  5. eddelbuettel commented on Mar 14, 2025

    @eddelbuettel
    MemberAuthor

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

  6. eddelbuettel commented on Mar 14, 2025

    @eddelbuettel
    MemberAuthor

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

  7. kevinushey commented on Mar 14, 2025

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

  8. eddelbuettel commented on Mar 14, 2025

    @eddelbuettel
    MemberAuthor

    That's the plan!

  9. eddelbuettel commented on Mar 18, 2025

    @eddelbuettel
    MemberAuthor

    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

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