[Bf-committers] C++ asserts

Matthew H. Plough mplough at Princeton.EDU
Mon May 23 22:36:17 CEST 2005


Ton Roosendaal wrote:

> Hi,
>
> Can someone with C++ knowledge find out why this "assert trapping" is  
> on in our C++ code?
>
> For example this bug report illustrates it:
> http://projects.blender.org/tracker/index.php? 
> func=detail&aid=2598&group_id=9&atid=125
>
> Instead of returning to Blender with an error (which is even handled  
> with a error message "Not manifold") it just crashes Blender...
>
> There's a test for MT_NDEBUG in ./intern/moto/include/MT_assert.h
>
> Changing this to be 'true' results in a
> ld: Undefined symbols: _MT_QueryAssert
>
> I've got no time for full recompile tests, please help! Get rid of  
> this! :)

I've been doing some tests with this, and it looks like the we could 
safely blow away _all_ the MT_assert calls in that file.  This is true 
for two reasons:

1) Each assert is followed by exception code.  Thus, each "exceptional" 
condition will be well handled inside a try-catch block farther up in 
the code.
2) The asserts are all MT_assert(false).  In Windows, this pops up a 
dialog that allows the user to, among other things, continue running the 
program, ignoring that assert whenever it is hit in the future.  In my 
testing, nothing crashes if I do ignore that assert.  Instead, "ERROR: 
No manifold mesh" comes up, as it should. 

Matt


More information about the Bf-committers mailing list