[gt-users] gt_assert
Gordon Gremme
gremme at gmail.com
Sat Oct 17 11:07:55 CEST 2009
> I am curious to know why the gt_assert() macro code is wrapped in a "do {...} while (false)" statement.
This way the compiler enforces a ';' after the gt_assert() macro call.
This wouldn't be the case with just the if-clause.
> An then I have another question. Currently, when a gt_assert in the code is exiting on error, and the reason is not obvious, I open gdb, set a breakpoint on the line producing the error under the condition opposite to the assertion and run. Is there a simpler way to make the gdb stop at the broken assertion point? If not: as I got tired to manually set the breakpoint, I was asking myself, if it would not be of general interest to offer a debugging env option or cli option to let gt_assert() be transformed in assert() calls or call directly abort() or anyway raise() a signal.
Just set a breakpoint on the exit() function. It is a little bit more
inconvenient than the default, but it works fine for me in practice.
Gordon
More information about the gt-users
mailing list