by john_moscow · 6y ago · 0 comments
#if DEBUG
#define TODO(msg)
#else
#define TODO(msg) #error msg
#endif
Works like a charm. I've got another PRERELEASE() macro that lets you do an unofficial preview build, but would break an official stable release.For anything more long-term you want to use a proper task management system with priorities, deadlines, dependencies and so on.
#if DEBUG
#define TODO(msg) #warning msg
#else
#define TODO(msg) #error msg
#endif #ifdef NDEBUG
#define assert(condition) ((void)0)
#else
#define assert(condition) /*implementation defined*/
#endif
...
assert(("There are five lights", 2 + 2 == 5));
...
test: test.cc:10: int main(): Assertion `((void)"There are five lights", 2+2==5)' failed.
Take it as a token that you are doing something right. :) static_assert(sizeof(StructUsedInSomeBinaryProtocol) == SomeConstantExpectedByTheOtherSide, "<...>")