On 2011-05-28 12:32:59 -0400, simendsjo <simen.end...@pandavre.com> said:

I don't think I understand the use case for assert(0) then.. I thought it was just a way getting assert in release mode.

The use case for assert(0) is the same as any assert(whatever): checking for things that shouldn't happen. Normally compiling in release mode would strip all the asserts to make things slimmer and faster. But given there is no cost in checking for assert(0), those are not stripped, they are just replaced with a halt instruction. So the assert's still there, but you don't have a message for it nor the line number.

If you want to see where the assertion happens, you can either compile in non-release mode or you can hook a debugger to your release executable and wait for the assert to happen.

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to