On Saturday June 06 2015 13:25:10 Thiago Macieira wrote:

> If you're hitting an assert, disabling the assert will make the problem 
> worse. 

Of course, but that doesn't mean by definition that the assert was there to 
avoid a crash. I've already seen them used as a cheap way to verify 
assumptions, or to put a watch on a special case that might need special 
attention but isn't easy to trigger IRL. The assert() documentation does 
suggest it's accepted or at least usual practise to build production code with 
-DNDEBUG...

In this particular case I removed the assert and the crash went away.

Annex. question: 3rdparty/harfbuzz aside, is there any code in Qt that compiles 
differently when using -DNDEBUG, for instance because it uses assert() directly?
 
>       assert(ptr);
>       ptr->i = 0;

Frankly, I think there's very little reason to use asserts in production code, 
at least when there are other ways to handle a fatal error situation. Even if 
there are no good ways to recover gracefully and continue execution, one could 
at least try to let the application exit correctly to avoid data loss. After 
all the assert is there to test for a condition that could lead to bad things 
but shouldn't yet have.

> Anyway, if this code is in the old hardbuzz-non-NG, what is preventing us 
> from 
> switching to NG?

You tell me :)

R.
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to