-
Notifications
You must be signed in to change notification settings - Fork 31
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
generic operator int() etc. #133
generic operator int() etc. #133
Conversation
4a9028e
to
6283e80
Compare
Hi @johnmcfarlane I'm really not sure if there is a standard rule governing this. Consider conversion of This seems like a subjective interpretation on my side, so I'm open either way. I believe Boost.Multiprecision might require explicit narrowing casts. I seem to recall some dialog with motivating reasons for/agains explicit narrowing casts. But I wonder if there is a rule governing this philosophy? |
7b5b90c
to
ed5b462
Compare
Re. explicit, I assume I'm replacing like for like here. Does the 'explicitness' of these functions change as a result of this PR? |
I should add that my original comment did not refer to explicit, simply that conversation did be possible at all - something the master branch currently does not facilitate. |
ed5b462
to
a8ad0ce
Compare
For completeness, I recommend the C++ Core Guidelines for guidance on matters like this, i.e. style and best practice. E.g. this rule. |
Indeed. Those are good guidelines. It's surprising how often I forget to adhere to some of them, or maybe didn't even have complete awareness of some of the newer ones such as those regarding move semantics correctness. Thanks for sharing. |
167b89e
to
301ed38
Compare
I still need to check this. Sorry about the delay @johnmcfarlane. |
301ed38
to
9cc8aff
Compare
Of course we can integrate this @johnmcfarlane. Sorry I missed the fact that the @johnmcfarlane I did, however, add a few more tests to CI, as I had noticed that I had earlier forgotten to run CI on gcc-clang-9. And I also enabled something in the So if you could merge my current master (after #138 gets cycled and merged to master), we will be good to go on merging or not needing any more the CNL branch --- however you see best. Then i think we will have at least a draft working model for continuing with CNL integration. |
Hi @johnmcfarlane there are actually 8 new checks in CI's YAML script and also set up in GitHub branch protection. Sorry about the late unannounced change. You probably need to merge wide-integer master here to move forward. |
9cc8aff
to
2934275
Compare
Thank you @johnmcfarlane I kind of lost track with all the activities going on. Is wide-integer moving in a usable direction now? |
@ckormanyos very much so, yes. I don't know if we were very close earlier in the year or whether you've made changes that really help but almost none of my tests are failing now after I substitute One last thing I'm looking at right now is this error. Which related to your earlier comment...
It's not as simple as that. It varies depending on toolchain and on the conformance setting. If you build with The error I linked to was in the only job where I enable strict conformance (via the A fix probably involves writing two constructors wrapped in |
BTW tests passing isn't necessarily the end of the story. I'm not sure how I want integration to happen. Given the relative scale of the two projects, dropping the one header directly into CNL and maintaining updates by hand might be the easiest thing. Have to think about it. Also there's the previous discussion on things like naming, error handling etc.. Let's revisit that once CI is passing. |
That is really good and makes me happy. Thank you.
We really got on the right track in spring with your help, @johnmcfarlane. Further improvements throughout summer helped further (some directly motivated through your comments, other clients and my own progression).
These led to a much more mature integral type and brought this work pretty close to actually being portable. |
I have an existing preprocessor switch called In the unrelated projects Boost.Math/Multirpecision if believe there is a sequence of compiler queries that attempts to check at compile time for the presence of In wide-integer, I do not know if we should expect the client to manually activate the use of
Sure @johnmcfarlane. I agree with you and believe that think constructor-from/cast-to signed and unsigned versions of Feel free to make an int28 branch or similar and give it a try. Or would you like me to make a branch? |
Definitely, @johnmcfarlane. johnmcfarlane/cnl will probably be better if it remains as dependency-free as possible --- certainly you'll want to be independent of a dependency on ckormanyos/wide-integer. If anything big happens on either your side or mine, we can synchronize up any time. I would really enjoy as a first step, let's see if we can get it in a plug-and-play form for johnmcfarlane/cnl while retaining proper functionality in my repo --- ultimately I want to know that it just fits in cnl. Then at that time of uniform compatibility, break off on self-managed copies with manual sync if needed. |
I'm also really pleased with how it's going. I wouldn't be surprised to find a few more issues because I never got as far as really putting wide types through their paces and will lean more heavily on wide-integer moving forward.
I support both those things via
I should probably make more effort to separate use of 128-bit in wide-integer from 128-bit conversions. And I think wide-integer should probably do the same, hence I recommend wrapping
OK. I'll try and get to that this week.
Really, it's just a scale thing. I think a dependency has advantages: fixes from wide-integer can easily be applied to CNL and it is crystal clear to users what the relationship is between the two packages.
I'm assuming manual syncs will be needed from time to time. For this reason, I'd support certain naming and API changes. I don't think they're essential but they have knock-on effects for the quality of CNL. |
Agreed on all points @johnmcfarlane. Thank you. |
I suspect that
char
is missing from the list of overloads. But more generally, there should be nothing stopping conversion to/from any integer. But for starters, __int128 is missing from the list of overloads and more generally, generic solutions FTW!