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

wrong test of HAVE_* macros #195

Open
DexterMagnific opened this issue Jun 6, 2019 · 1 comment
Open

wrong test of HAVE_* macros #195

DexterMagnific opened this issue Jun 6, 2019 · 1 comment

Comments

@DexterMagnific
Copy link

Hi,

When you detect that a function is missing, you define HAVE_FOO=0 in the command line (via add_definitions) and test it in the code like this:

#if defined(FOO)
...
#else
...
#endif

This is wrong since FOO is defined, regardless of its value.

The fix consists in either changing #if defined(HAVE_FOO) to #if HAVE_FOO or to remove the add_definitions() when the valus is zero.

source: https://stackoverflow.com/a/21312684

Regards

@mikkoi
Copy link
Contributor

mikkoi commented Sep 9, 2019

You are right. The difference is subtle but meaningful. Like assert() macro and NDEBUG. Even if NDEBUG=0, assert deactivates itself. These need to be checked.

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

No branches or pull requests

2 participants