question to the c experts (@johnregehr ?): Is a size_t overflow undefined behavior? and if yes, how do you check when doing a multiplication
-
-
Replying to @hanno @johnregehr
Not sure what you mean. size_t is an unsigned type so there is no "overflow"; it's modular arithmetic.
1 reply 0 retweets 1 like -
The right check for a*b overflow is (a && b>SIZE_MAX/a). Modern compilers should compile this to "jc" or equiv.
1 reply 0 retweets 1 like -
mul;jc, that is.
1 reply 0 retweets 0 likes
5:49 PM - 23 Feb 2017
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.