Comment

Comment by harry8

doesn't everyone write their own assert macros?

    ASSERT(cond, "msg %s", str_contents); //#ifndef NDEBUG logic
    ASSERT_ALWAYS( ...); 
check the condition, write out the msg, maybe dump a backtrace if that works in your codebase, call abort();.

assert() is just kind of nasty, why use it?

precondition in the function sig is just "We know you don't document and nobody reads it if you do." Which is great, but not worth the control you get writing your own ASSERT_ALWAYS() and being able to s/_ALWAYS//if the performance in release matters.

parent harry8 15 days ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton