Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Forcing Qt container bounds checking
Asperamanca last edited by
I'd like to force Qt containers to perform bounds checks even in release mode, and I am willing to pay the performance price. There's nothing like an undetected memory overwrite to ruin your data and make your day. Better to crash...
The way I read the code, all I need to do is define QT_FORCE_ASSERTS in my project. Since most of the really important assertions are in the container header files, I would get at least those for my uses of Qt containers.
I am aware that
- QT_FORCE_ASSERTS is undocumented, so it may change without notice
- I won't get assertions for any Qt-internal use of Qt containers
Do you have any better suggestions on how to do it in an official and documented way?
@Asperamanca AFAIK, the code is highly optimized for size and speed. So beside the assertations the is no extra safety net - at least for the code I'm aware of. you can always check yourself - the sources are available after all.