-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
allow long long on 64bit windows #811
Conversation
Thanks @kevinushey for looking into it! |
@kevinushey on win-builder r-devel I get:
Do we need additional C++11 protection around these? |
grumbles loudly Let me think about whether there's an alternate mechanism by which we can get a 64bit integer type on Windows. I'd love for this to work even without C++11 but worst case scenario we can just add that in. |
I am 100% certain that we fought these dragons many times before. And at some point I just gave it a major fsck this as you cannot argue away the sillyness of the is C++ 1998 (hey, twenty years) requirement for an entirely irrelevant standard. But long and short, unless users opt into C++11 (as eg my RcppBDT for Boost date_time did maybe six years ago) to get I would be delighted to be proven wrong but don't expect it. |
Ok, win-builder came back with a thumbs up and I suggest that we go fix this fix: modified inst/include/Rcpp/longlong.h
@@ -40,9 +40,11 @@ __extension__ typedef unsigned long long int rcpp_ulong_long_type;
// The Rtools toolchain provides long long on 64bit Windows
#ifdef _WIN64
+#ifdef RCPP_USING_CXX0X_OR_LATER
typedef long long rcpp_long_long_type;
typedef unsigned long long rcpp_ulong_long_type;
#define RCPP_HAS_LONG_LONG_TYPES
#endif
+#endif Any objections? I will be less 'global' that what @krlmlr had hoped but such is life when our good friends insist on C++98 for reasons way beyond our comprehension. |
I'm going to take another look at this so may follow up with another PR. |
(but if I fail I think that will be the right change) |
Can we just set |
@krlmlr Yes the 'use C++11' trick has worked (and been used) for many many years. @kevinushey ok |
Do I understand correctly that we can't just add in Can we add some protection to avoid the underlying issue to occur in the future? I'd like to see an error or a warning if a vector constructor is called with an |
We didn't do this for Rcpp as we would then force down a newer compiler. @jjallaire usually reminds us of the numerous old RHEL instances still trying to build it. We impose a new(er) compiler for RcppArmadillo and get occassional issues back, see its issue tickets. As for |
I'm only suggesting to enable C++11 on Windows. Would that work? |
Maybe. But I don't like the idea of splitting standards. And 4.9.3 is not really C++11 compliant, it just pretends to be. (For RcppCCTZ we ported something from the C++ Std Lib back.) And the patch by @kevinushey is functionally equivalent. |
Fixes #804. Because the compiler toolchain on Windows provides long long regardless of whether C++98 or a newer standard is requested, this usage should be permissible on CRAN.
In addition, because
R_xlen_t
andstd::size_t
are actually defines forlong long
andunsigned long long
on 64bit Windows, those constructors now work 'for free'.