Debug - mhightower83/Arduino-ESP8266-misc GitHub Wiki

C++ Specifics I Forget Over Time

assert

Performs run-time assertion checking when NDEBUG is not defined. C++ docs on assert

How to use the assert macro with a message.

Method 1:

bool testbool = false;
assert(("this is the time", testbool));

Method 2:

bool testbool = false;
assert(testbool && "This is a message");

With method 2 newer compilers may give a warning. Alternative:

bool testbool = false;
assert(testbool && (NULL != "This is a message"));

static_assert

Performs compile-time assertion checking. C++ docs on static_assert

static_assert ( bool-constexpr , message ); //	(since C++11)
static_assert ( bool-constexpr );           //	(since C++17)

C++ Operator Precedence

C++ Operator Precedence