Changes defines in include guards to avoid undefined behaviour#483
Merged
ZigRazor merged 1 commit intoZigRazor:masterfrom Feb 3, 2025
Merged
Changes defines in include guards to avoid undefined behaviour#483ZigRazor merged 1 commit intoZigRazor:masterfrom
ZigRazor merged 1 commit intoZigRazor:masterfrom
Conversation
ZigRazor
approved these changes
Feb 3, 2025
Owner
|
It's ok for now. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The problem
The C++ standard says that identifiers starting with an underscore (_) are reserved for the standard library and should not be used by code. It also specifies that a double underscore anywhere is reserved for compiler use like
__attributeor__assume.My changes
I have changed the include guards (
#ifndef __CXXGRAPH_..._H__) to remove this undefined behaviour.I noticed the use of
#pragma oncein all the headers I changed. Since we only support C++17 and this became standard in C++17 it is safe to remove the older style include guards but I have left them alone for now, let me know if you'd like them changed.More information can be found from Jason Turner or on cppreference
I haven't created an issue but I can do if you wish