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

types: add re_assert and re_assert_se definition #900

Merged
merged 3 commits into from
Aug 10, 2023
Merged

types: add re_assert and re_assert_se definition #900

merged 3 commits into from
Aug 10, 2023

Conversation

sreimers
Copy link
Member

@sreimers sreimers commented Aug 9, 2023

cmake -B build -DCMAKE_BUILD_TYPE=Debug

int err;
re_assert(!(err = myfunc())); /* myfunc() is executed and assert() calls abort() if expr is false */
re_assert_se(!(err = myfunc())); /* myfunc() is executed and assert() calls abort() if expr is false  */

cmake -B build -DCMAKE_BUILD_TYPE=Release

int err;
re_assert(!(err = myfunc())); /* myfunc() and assert() are not executed in release builds */
re_assert_se(!(err = myfunc())); /* myfunc() is executed in release build (keeps side effect) but assert() is not called */

@sreimers sreimers marked this pull request as ready for review August 9, 2023 16:08
@sreimers sreimers changed the title type: add re_assert definition type: add re_assert and re_assert_se definition Aug 9, 2023
@sreimers sreimers force-pushed the re_assert branch 2 times, most recently from 33ddacb to c1624be Compare August 9, 2023 18:03
@sreimers sreimers changed the title type: add re_assert and re_assert_se definition types: add re_assert and re_assert_se definition Aug 9, 2023
@sreimers sreimers marked this pull request as ready for review August 9, 2023 22:05
@sreimers sreimers merged commit bb1953b into main Aug 10, 2023
38 checks passed
@sreimers sreimers deleted the re_assert branch August 10, 2023 07:36
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.

1 participant