Hello,
while reading some nrf5 examples, I've stumbled over a pattern in the examples, where the result code of a function is stored in variable (most of the time named err_code
) and then this variable is passed to APP_ERROR_CHECK
. Intuitivly, I would directly pass the funtion result to the APP_ERROR_CHECK
macro ("APP_ERROR_CHECK( f() )"). Is there any particular reason for this pattern, or is it just a "habit" comming the pitfalls when using assert
?
Is it safe to directly pass the return value of a function call to APP_ERROR_CHECK
(I found nothing in the documentation, nor the implementation that tells that the argument to the macro would not be evaluated or would be evaluated more than once).
kind regards,
Torsten