On 14/08/2013 12:05, Brian Gladman wrote: > On 14/08/2013 11:54, Brian Gladman wrote: >> On 14/08/2013 11:06, degski wrote: >>> Hi Brian, >>> >>> It does fail for me though: >>> >>> Z:\VC\x64\include\mpirxx.h(1596): error : invalid redeclaration of member >>> function "__gmp_expr<mpz_t, mpz_t>::__gmp_expr(__int64)" (declared at line >>> 1590) >>> __gmp_expr(intmax_t l) { mpz_init_set_sx(mp, l); } >>> ^ >>> >>> Z:\VC\x64\include\mpirxx.h(1597): error : invalid redeclaration of member >>> function "__gmp_expr<mpz_t, mpz_t>::__gmp_expr(unsigned __int64)" (declared >>> at line 1591) >>> __gmp_expr(uintmax_t l) { mpz_init_set_ux(mp, l); } >>> ^ >>> This already happens when just including the header mpirxx.h in a project >>> (VS2012/release/x64). >> >> Looking at the tests, there is no test that checks things when <cstdint> >> is included. I suspect that this is why I don't see these errors. > > As I suspected, when I include <cstdint> the errors turn up. > > So when <cstdint> is included, we need to: > > (a) check if (u)intmax_t is a 'long' and, if it is: > (b) check if there is an equivalent 'long' overload; > (c) if there is, don't declare any overloads on (u)intmax_t > > (d) check if (u)intmax_t is a 'long long' and, if it is: > (e) check if there is an equivalent 'long long' overload; > (f) if there is, don't declare any overloads on (u)intmax_t > > If there are no situations where (u)intmax_t is not either 'long' or > 'long long' we could simply remove all these declarations. > > Otherwise I wonder what are the right set of MACROS to achieve the above > guards?
Answering (partly) my own question, it seems that C++11 has the solution using <type_traits>: --------------------------------------------- #include <type_traits> template< class T, class U > struct is_same; --------------------------------------------- so we could just remove these defines for 'old' use and add this solution for 'new' C++ code. But this would mean adding <type_traits> to mpirxx.h. Would this cause any problems? > > Brian > -- You received this message because you are subscribed to the Google Groups "mpir-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to mpir-devel+unsubscr...@googlegroups.com. To post to this group, send email to mpir-devel@googlegroups.com. Visit this group at http://groups.google.com/group/mpir-devel. For more options, visit https://groups.google.com/groups/opt_out.