Recall that macro substitution is a fairly simple replacement mechanism. So if you have a function-style macro like this:
Code:
#define ADD(x, y) ((x) + (y))
and you use it like this:
Code:
printf("%d\n, ADD(1, 2));
what happens is that after preprocessing, it is as if you had written:
Code:
printf("%d\n, ((1) + (2)));
The "extra" parentheses are there because you might write something like this:
Code:
printf("%d\n, ADD(1, 2 + 3) * 4);
which becomes:
Code:
printf("%d\n, ((1) + (2 + 3)) * 4);
whereas if you had omitted the parentheses it would become:
Code:
printf("%d\n, 1 + 2 + 3 * 4);
which is probably not what you wanted due to how precedence comes into play.
So if we go back to NRFX_CHECK, you can see that it is exceedingly simple (and if you don't care about the flexibility or whatever else the author had in mind, you arguably don't need it). NRFX_CHECK(0) resolves to (0) because for this particular macro substition, 0 is module_enabled, and the rule says that the macro is replaced by (module_enabled), i.e., it becomes (0). That's it. Don't overthink.
If you really really cannot understand, then consider this function:
Code:
int foo(int module_enabled)
{
return module_enabled;
}
We now call this function:
Code:
printf("%d\n", foo(0));
What is the output, and why? The function-style macro works along similiar lines, though you must keep in mind that it is a macro, not a function.