Skip to content
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

Changes defines in include guards to avoid undefined behaviour #483

Merged
merged 1 commit into from
Feb 3, 2025

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, sbaldu and nrkramer 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