Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Forcing Qt container bounds checking

Forcing Qt container bounds checking

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 432 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    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?

    aha_1980A 1 Reply Last reply
    0
    • A Asperamanca

      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?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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.

      Regards

      Qt has to stay free or it will die.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved