-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Remove unnecessary explicit constructors #415
Conversation
stl/inc/strstream
Outdated
@@ -34,7 +34,12 @@ public: | |||
}; // set if character array ownership given away | |||
using _Strstate = int; | |||
|
|||
explicit __CLR_OR_THIS_CALL strstreambuf(streamsize _Count = 0) { | |||
// construct with empty character array | |||
__CLR_OR_THIS_CALL strstreambuf() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it might be an ABI break (otherwise why would it be annotated __CLR_OR_THIS_CALL
?)
Alternately the __CLR_OR_THIS_CALL
annotation might be incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is definitely concerning - the presence of explicit calling conventions strongly indicates separately compiled machinery that we can't mess with. However, in the specific case of strstreambuf
, I believe that this may be okay. The base class basic_streambuf
has explicit calling conventions because it is indeed separately compiled. However, I can't find any mentions of strstream
(including strstreambuf
) in either the static or dynamic libraries. Therefore, I believe that splitting this constructor should be ABI-safe. Our test to verify the export surface will serve as a double-check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Stephan's analysis. If none of these are exported, should we file a separate issue to remove __CLR_OR_THIS_CALL
from all of this class's function declarations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would be unnecessarily risky for no benefit. This is strstream, after all - the entire thing is deprecated and rarely changes. Also, the virtuals need explicitly specified calling conventions to match the base class, even if the non-virtuals don't.
(Also, vNext will eliminate separately compiled classes.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NO chage done
Yes, the codegen for that is very poor due to the interaction with EH :( |
stl/inc/strstream
Outdated
@@ -34,7 +34,12 @@ public: | |||
}; // set if character array ownership given away | |||
using _Strstate = int; | |||
|
|||
explicit __CLR_OR_THIS_CALL strstreambuf(streamsize _Count = 0) { | |||
// construct with empty character array | |||
__CLR_OR_THIS_CALL strstreambuf() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Stephan's analysis. If none of these are exported, should we file a separate issue to remove __CLR_OR_THIS_CALL
from all of this class's function declarations?
402292e
to
1c38b3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed a commit with some comment-wrapping cleanup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The distributions' param_type
are specified by reference to the distributions' constructors, so the changes to the distributions need to apply to their param_type
as well. (This is intentional.)
@timsong-cpp Thanks a lot for the hint. I was unaware of that connection. Fixed it and pushed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. I found a couple of extremely minor comment/whitespace nitpicks, but I believe this is ready to merge as-is. (I double-checked the paper and verified that all edits were applied or already present.) We might want to add tests for this (although I am tempted to be lazy).
cbde18f
to
cb20871
Compare
Rebased to resolve merge conflict in yvals_core.h. This has passed my test run; beginning the final Microsoft-internal PR now. |
Thanks for implementing another C++20 feature! This will appear in VS 2019 16.6 Preview 1. |
Description
This fixes #41 by unconditionally defining the default constructors
In contrast to the paper the constructors do not utilize the explicit constructors as that seems to be against the common praxis of the STL
Checklist
Be sure you've read README.md and understand the scope of this repo.
If you're unsure about a box, leave it unchecked. A maintainer will help you.
_Ugly
as perhttps://eel.is/c++draft/lex.name#3.1 or there are no product code changes.
verified by an STL maintainer before automated testing is enabled on GitHub,
leave this unchecked for initial submission).
members, adding virtual functions, changing whether a type is an aggregate
or trivially copyable, etc.).
the C++ Working Draft (including any cited standards), other WG21 papers
(excluding reference implementations outside of proposed standard wording),
and LWG issues as reference material. If they were derived from a project
that's already listed in NOTICE.txt, that's fine, but please mention it.
If they were derived from any other project (including Boost and libc++,
which are not yet listed in NOTICE.txt), you must mention it here,
so we can determine whether the license is compatible and what else needs
to be done.