Skip to content

Comments

Changes defines in include guards to avoid undefined behaviour#483

Merged
ZigRazor merged 1 commit intoZigRazor:masterfrom
JustCallMeRay:master
Feb 3, 2025
Merged

Changes defines in include guards to avoid undefined behaviour#483
ZigRazor merged 1 commit intoZigRazor:masterfrom
JustCallMeRay:master

Conversation

@JustCallMeRay
Copy link
Contributor

@JustCallMeRay JustCallMeRay commented Jan 3, 2025

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

@JustCallMeRay JustCallMeRay marked this pull request as ready for review January 3, 2025 19:03
@ZigRazor ZigRazor requested review from ZigRazor, nrkramer and sbaldu and removed request for ZigRazor and sbaldu February 3, 2025 14:02
@ZigRazor
Copy link
Owner

ZigRazor commented Feb 3, 2025

It's ok for now.
You can open an issue to remove the older style guard.
Thank you in advance.

@ZigRazor ZigRazor merged commit 985625e into ZigRazor:master Feb 3, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants