Skip to content

Add compile-time production feature without assert()s - #184

Open
TCY16 wants to merge 1 commit into
developfrom
features/configure-production
Open

Add compile-time production feature without assert()s#184
TCY16 wants to merge 1 commit into
developfrom
features/configure-production

Conversation

@TCY16

@TCY16 TCY16 commented Aug 23, 2022

Copy link
Copy Markdown
Contributor

No description provided.

@TCY16
TCY16 requested a review from wtoorop August 23, 2022 16:47
@wtoorop

wtoorop commented Jul 12, 2024

Copy link
Copy Markdown
Member

I'm not sure and have to consider

@pemensik

pemensik commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

I do not like all conditions are specified multiple times. I think it might make sense to define custom ASSERT_RETURN macro, which would work like normal assert in standard configuration, but would change with _NDEBUG macro defined to returns.

But, there is no speed benefit if you put returns on every single place where some assert have been. It will make sense only if number of such returns would be lower than common asserts.

@wtoorop

wtoorop commented Dec 5, 2025

Copy link
Copy Markdown
Member

Thanks @pemensik That is good input for the considering this PR. An ASSERT_RETURN would make it already more acceptable yes. But it still feels icky to change behaviour of a function that would stop the program when compiled with the NDEBUG define. I mean, maybe people start counting on the behaviour of some of those functions to return NULL on certain conditions, which would crash the program on other systems compiled without the NDEBUG define.

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