-
Notifications
You must be signed in to change notification settings - Fork 5
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 old #if
hacks for older compilers from Delegate
#1017
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
462da28
Remove workaround for old GCC compilers
DanRStevens ad315cc
Remove function type syntax guard
DanRStevens f958f6c
Remove no longer referenced macro define
DanRStevens 1aa3e53
Adjust namespace blank line padding
DanRStevens ef703d5
Remove conditionals for always defined macro
DanRStevens 96e7900
Remove check for ancient version of MSVC
DanRStevens 2f02cae
Remove nested define for `__single_inheritance` feature check
DanRStevens 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
There are no files selected for viewing
This file contains 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.
This should also be removed since its outer
#ifdef
check was also removed. Additionally, the identifier uses syntax that is reserved; in this case, the variable identifier contains double underscores.Ref: https://en.cppreference.com/w/cpp/language/identifiers#In_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.
Well, that code was normally enabled for MSVC. There are two nested
#ifdef
checks, both of which were permanently enabled for MSVC. I removed one of them, related to the__single_inheritance
feature check, since that feature was added long ago, so any version supporting C++17 will have it available. The only check that's really relevant is if the code is being compiled by MSVC or not.Btw,
__single_inheritance
is an MSVC specific keyword here, not an identifier. It affects the size of pointer to member functions, when the pointer is taken on an incomplete type, so the compiler is not yet able to deduce the inheritance being used.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.
Hmm, I learned something today. That said, I really try to avoid using compiler-specific extensions. It just makes things harder.
The article linked remarks that the
pointers_to_members
pragma can be used instead and since it is the C++-specific alternative. (i.e., not Microsoft-specific, i.e. cross-platform) I would lean towards using that instead.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.
Always good to learn something new. 🙂
The
__single_inheritance
keyword is class specific: (Emphasis mine)The other methods set a default that applies to all classes. We may want to avoid changing the default and potentially affecting other classes that we didn't mean to impact. The
pointers_to_members
pragma page comes with a warning:Keep in mind that
Delegate
is a template class, so all code is in a header file, which means any including file would be impacted by apragma
that changes a compiler default.Perhaps more to the point though, that use of
__single_inheritance
was pre-existing, so somewhat out of scope for this PR. I hadn't looked into its use very carefully, so it wasn't something I really wanted to change.