Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Use NDEBUG instead of _DEBUG so that debug / release detection is cross platform #134

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
Loading
from

Conversation

Gaspard--
Copy link

Currently, on linux the "default" compilation config will run the release config even in debug, since _DEBUG is MSVC only.
This PR proposes switching to the NDEBUG define, which is specified by the C / C++ standards, and thus should be cross platform.

One minor caveat however is that it used to control asserts, and it can be defined or undefined independently of the actual compilation flags.
I don't know of any standard way to avoid this, so maybe a cleaner solution would be to pass a custom flag trough cmake or something like that, which is a little more complex than a one-line modification :P

In practice however, cmake (and most build systems) sets this flag when not in debug, and from my experience projects that have complex logic for handling which asserts to enable / disable opt for their own custom defines anyway, so I think this is acceptable.

@Gaspard--
Copy link
Author

I thought about this for 2 minutes more, and I think a custom define is the only sane solution after all. I'll let you judge if you want to close or merge this.

@dougbinks dougbinks self-requested a review May 28, 2024 17:19
@dougbinks
Copy link
Collaborator

This seems reasonable - the compile options can be easily set by any end user of the library so adding a custom define seems unnecessary.

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.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.