Comment

Comment by harry8

I'm used to libraries being release builds so NDEBUG is defined and assert() is compiled out - in debug builds of client code. I'm not understanding what you mean by "standard interface."

What is an assert handler? Is it a debugger for the dump so you can get a backtrace and examine things that way? $ gdb ./prog core Your macro finishes by calling abort() so you have that.

The value of being able to print an arbitrary string, with whatever current variable values you like is not nothing. Printing out a backtrace (if you can with your codebase) is also really useful. Obviously your own macro will print file, line and function. assert(a == b); triggering tells you almost nothing about the failure, why the check was there, what failed etc. It really should.

parent harry8 12 days ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton