Hi,
You are getting this warning because your code is wrong – it is helping
you find a bug.
The only integer constant you can safely compare with a pointer is 0,
because that is a “null pointer constant”. (Note you can’t compare a
pointer to an int that happens to be 0 – you can only compare to the
constant 0.)
What you are trying to do is check that the handle is valid – i.e., it
is non-zero. You do /can/ that by:
configASSERT(myTimer.GetHandle() != pdFAIL);
You /cannot/ do it by asserting that the handle value is pdPASS.
It is almost certainly better, IMHO, to simply assert that the handle is
valid by a conversion to bool:
configASSERT(myTimer.GetHandle());
This is idiomatic C and C++. Adding ” != pdFAIL” gives no benefits,
while ” == pdPASS” is directly wrong.
I have not looked in the context of projedefs.h or how these macros are
intended to be used. But as a general point, I am always highly
sceptical about using “home-made booleans”. FreeRTOS is designed to
work with pre-C99 C, and thus needs to use them – your code is C++14,
and does not need them. When you need a boolean type, use “bool” – when
you need boolean values, use “true” and “false”. And when you need a
null pointer constant, use nullptr (for C++11 onwards) or NULL (for C).
You can also use 0 directly, but prefer nullptr when you can, NULL when
you can’t. Avoid using cast expressions like you get from the pdFAIL macro.