Hi,
My app was written on Windows PC/MSVC and is ported to nRF52/Keil.
In many places I've used MSVC assert() macro in the following manners:
- assert(function(arg1, arg2) == SUCCESS)
- assert(ptr)
- assert(ptr && intvar)
etc...
When porting it to nRF 52 I've tried to replace assert() with a generic MY_ASSERT() macro:
#if WINDOWS_PC
#define MY_ASSERT(cond) assert((cond))
#else // nRF52+Keil
#define MY_ASSERT(cond) ASSERT((cond))
#endif
Unfortunately when wrapping a function call+comparison MY_ASSERT(function(a,b) == SUCCESS), the source line is optimized out...
I tried to use ERROR_CHECK and also to implement do{int local_var = (cond); ASSERT(localVar);} while(0) type of tricks but it just doesn't work/compile
Any thoughts?
Thanks