Adding message to assert

前端 未结 8 1604
花落未央
花落未央 2020-12-12 20:36

Hallo!

I\'m looking for a way to add custom messages to assert statements. I found this questions Add custom messages in assert? but the message is static there. I w

8条回答
  •  遥遥无期
    2020-12-12 21:00

    #define ASSERT_WITH_MESSAGE(condition, message) do { \
    if (!(condition)) { printf((message)); } \
    assert ((condition)); } while(false)
    

提交回复
热议问题