-
Notifications
You must be signed in to change notification settings - Fork 1.4k
C++17 fixes #591
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
Closed
Closed
C++17 fixes #591
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b490f2e
Fix check for std::apply (R__HAS_STD_APPLY)
davidlt f692ada
Set __cplusplus to 201703L for C++1z (C++17)
davidlt 35469f4
Don't provide std::__ROOT::apply if R__HAS_STD_APPLY is defined
davidlt da6e821
Add missing <functional> header
davidlt 9fc549c
Fix std::string_view usage if compiled in C++17 mode
davidlt be8dddd
Apply git clang-format suggested changes
davidlt 0276049
Provide null-terminated C strings
davidlt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Apply git clang-format suggested changes
Signed-off-by: David Abdurachmanov <[email protected]>
- Loading branch information
commit be8dddd13f1fb758a9cb546a1441e18d24c2fbfe
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Isn't data() not guaranteed to be null terminated? (which WriteObjectAny requires)?
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.
You are right. Starting C++11
std::string.data()and.c_str()both provide null-terminated result, but the same does not apply tostd::string_view. The example I am looking even shows that one needs to create a temporary string and then call.data().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.
Could you point me to the comment in the code which states that it's required? At first look I don't see it explicitly mentioned in
TBufferFile::WriteObjectClassorTBufferFile::WriteObjectAnyand I didn't see any breakage in CMSSW.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.
Ops, it should be
TDirectoryFile::WriteObjectAny, but same story. No comments mention that it should be null-terminated. Even provided example is not null-terminated.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 somehow did not catch that. Thanks!
Humm ... WriteObjectAny takes a const char* and use it as null terminated string, I am not sure why there would be a 'special' comment in this routine to make that explicit ...
It is clear that std::string_view::data is not appropriate here, as this returns the first characters of the view, which could for example be a sub-part of a larger string.
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.
Weekend already. I was looking at completely different argument :)