On Wednesday 25 February 2015 21:29:31 Marc Mutz wrote: > > -- why should now people have a slower library because > > of all those checks? > > Q_CHECK_PTR does not necessarily make the library slower. It only needs to > be applied to malloc/calloc and nothrow operator new, because ordinary new > already throws. We can port such code to normal operator new instead.
Writing the checks is useless unless we also write the code to recover from such situations. For the case of exceptions, we need to make sure that the code survives stack unwinding somewhat gracefully until the exception handler. For the case of nullptrs, we need to ensure that functions exit indicating errors or setting error states in the objects. The checks themselves may not be the performance bottleneck. Rearranging the code around to make sure that the check is useful is the bottleneck. Unless we take the suggestion elsewhere in this thread to reliably and immediately terminate the application. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development