Changes defines in include guards to avoid undefined behaviour #483
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
__attribute
or__assume
.My changes
I have changed the include guards (
#ifndef __CXXGRAPH_..._H__
) to remove this undefined behaviour.I noticed the use of
#pragma once
in 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