Conversation
stl/inc/codecvt
Outdated
| constexpr int _Little_first = 1; | ||
| constexpr int _Big_first = 2; | ||
| constexpr int _Bytes_per_word = 4; |
There was a problem hiding this comment.
In stl/inc headers, we conventionally say _INLINE_VAR constexpr, for example:
Line 30 in 2bd2bd2
This expands to inline constexpr in C++17 mode, which makes a difference if the constant is ever address-taken (hopefully not for these constants, but we follow the convention anyways).
stl/inc/codecvt
Outdated
| #define _BYTES_PER_WORD 4 | ||
| constexpr int _Little_first = 1; | ||
| constexpr int _Big_first = 2; | ||
| constexpr int _Bytes_per_word = 4; |
There was a problem hiding this comment.
_BYTES_PER_WORD appears to have been completely unused and should be eliminated.
stl/inc/xmemory
Outdated
| }; // tag to indicate that a proxy is being allocated before it is safe to bind to a | ||
| // _Container_base12 |
There was a problem hiding this comment.
This comment can now be unwrapped to a single line. (clang-format wraps excessively long comments, but won't unwrap in situations like this.)
stl/inc/xutility
Outdated
| struct contiguous_iterator_tag : random_access_iterator_tag {}; | ||
| struct contiguous_iterator_tag : random_access_iterator_tag { | ||
| explicit contiguous_iterator_tag() = default; | ||
| }; |
There was a problem hiding this comment.
Unfortunately, the "explicit default constructor" improvement can't be extended to these Standard types, so please revert this group of changes.
The issue is that WG21-N4849 [std.iterator.tags]/1 (see https://eel.is/c++draft/std.iterator.tags#1 for HTML instead of PDF) specifies the Standard tag types, with implicit default constructors, so we have to match that observable behavior. In contrast, we can do basically whatever we want with internal non-Standard types like _Priority_tag below.
There was a problem hiding this comment.
Oh okay let's revert so !
thanks a lot !! I didn't aware about that
stl/src/memory_resource.cpp
Outdated
| extern "C" _CRT_SATELLITE_1 _Aligned_new_delete_resource_impl* __cdecl _Aligned_new_delete_resource() noexcept { | ||
| _EXTERN_C | ||
| _CRT_SATELLITE_1 _Aligned_new_delete_resource_impl* __cdecl _Aligned_new_delete_resource() noexcept { |
There was a problem hiding this comment.
The extern "C" changes in this file are unrelated to the tag changes in the rest of the PR. While this transformation doesn't change the meaning of the code, it introduces inconsistency with the declarations in <memory_resource>. If you believe that we should consistently rely on _EXTERN_C blocks for declarations and definitions, please file an enhancement issue so we can make a decision - and then if we decide on a convention, it can be cleaned up in a separate PR.
The general principle is that large code transformations/cleanups should be performed in separate PRs for ease of code reviewing and history reading. Mixing in very small changes can be OK (e.g. comment changes, or the _Default_resource{nullptr} initialization change above - that one is at least thematically related to "brace-initialize more things").
I noticed similar changes in #487 but didn't object then because they were small and increased consistency between the declarations and definitions. I probably should have mentioned my concerns though, apologies for not doing so earlier.
There was a problem hiding this comment.
Yeah totally right !, let's revert and consider another PR for these changes
The
extern "C"changes in this file are unrelated to the tag changes in the rest of the PR. While this transformation doesn't change the meaning of the code, it introduces inconsistency with the declarations in<memory_resource>. If you believe that we should consistently rely on_EXTERN_Cblocks for declarations and definitions, please file an enhancement issue so we can make a decision - and then if we decide on a convention, it can be cleaned up in a separate PR.
There was a problem hiding this comment.
you don't need to apologies 😉, what do you think about a file an enhancement issue and assign it to me ?
I noticed similar changes in #487 but didn't object then because they were small and increased consistency between the declarations and definitions. I probably should have mentioned my concerns though, apologies for not doing so earlier.
stl/src/parallel_algorithms.cpp
Outdated
| } | ||
|
|
||
| extern "C" { | ||
| EXTERN_C_START |
There was a problem hiding this comment.
These are <Windows.h> macros, but we conventionally use the STL's macros for this (in fact, I had to look up where this was coming from). I think it would be fine to use the STL macros here in this PR.
There was a problem hiding this comment.
this means that we should include <yvals_core.h>
as we said above, let's file a new enhancement issue for a diff PR
stl/src/parallel_algorithms.cpp
Outdated
| } | ||
|
|
||
| } // extern "C" | ||
| EXTERN_C_END // extern "C" |
There was a problem hiding this comment.
When changing this to the STL's macro, the comment should also be dropped (as it no longer serves a purpose).
stl/src/sharedmutex.cpp
Outdated
|
|
||
| extern "C" { | ||
|
|
||
| EXTERN_C_START |
There was a problem hiding this comment.
Same comments about using STL macros instead of <Windows.h> macros.
revert "explicit default constructor" on Standard tag type, revert "extern "C"" for another PR
StephanTLavavej
left a comment
There was a problem hiding this comment.
Perfect; I will port this to our Microsoft-internal repo and merge it soon. Thank you!
`_Lex_compare_optimize` now has an explicit default constructor,
so we can't return `{}`. Usage through an alias template also needs
to be fixed.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Thank you for improving the codebase's consistency and readability! |
Description
Fixes #468.
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.
_Uglyas 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.