10 ms·
It depends on what operation could potentially overflow. Mozilla has a CheckedInt (C++) type that checks all operations for overflow. You can see examples of h
by derf_ 8y ago
It depends on what operation could potentially overflow.
Mozilla has a CheckedInt (C++) type that checks all operations for overflow. You can see examples of how this is actually implemented here: <https://searchfox.org/mozilla-central/source/mfbt/CheckedInt.h#254> https://searchfox.org/mozilla-central/source/mfbt/CheckedInt.... You can derive similar C implementations if you work through all of the template magic.
Be warned that the definition of what is undefined, implementation-specific, and well-defined varies depending on the exact version of the C or C++ standard you use.