summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfutureinterface.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2025-02-02 15:35:18 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2025-02-10 23:17:18 +0100
commit419ebb2770eb606762dcca96978b7b26299aafd9 (patch)
tree5064c8d9711b6e991bab4b4240aba94e906ff00d /src/corelib/thread/qfutureinterface.cpp
parent696e11ec729452d246e736e54790411b408f9c3c (diff)
Long live QCheckedInt
This is a private and minimal "safe int" API for internal uses. It has configurable policies for * how to carry out a given arithmetic operation (check for overflow, just do the native language operation, ...); * how to report an error in case the operation fails (Q_ASSERT, ignore it, ...). By default, operations are implemented via the q*Overflow family of functions, and Q_ASSERT is used to report errors. This means an arithmetic error will be fatal in debug mode, and implement wraparound in release mode. However, UB will be prevented; the compiler will generate the same assembly, but it won't be allowed to exploit overflows as an UB source (that's because q*Overflow has well-defined behavior). In C++26 jargon, the program will have EB at this point. The class is also supposed to be binary compatibile with the type it wraps, so that it can be used to replace an `int` data member, without breaking ABI. (Of course the mangling will be different, but this is an implementation detail and it's not supposed to be exposed.) It's woefully incomplete (operator% is missing, for instance); I just needed a MVP to support the upcoming changes to the geomery classes. This is meant to stay completely private, users that need a real implementation should use Howard Hinnart's bbi. Change-Id: I69ea20e872e395a505c5748f24105469dfb60d84 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qfutureinterface.cpp')
0 files changed, 0 insertions, 0 deletions