Because it violates the as-if rule. The calloc call is required to fail; transformation makes it succeed.
-
-
Replying to @RichFelker @solardiz
What requires this calloc call to fail? C11? POSIX? For all sizes > PTRDIFF_MAX? Or > SIZE_MAX?
2 replies 0 retweets 0 likes -
Multiple things. The most important is the compiler's inability to handle objects > PTRDIFF_MAX in a consistent manner.
2 replies 0 retweets 0 likes -
But C also reqs an obj of size n*m be produced, or calloc fail. Since the former is not possible, latter is mandatory.
1 reply 0 retweets 1 like -
-
Replying to @ch3root
because of the definitions of size_t and of SIZE_MAX
2 replies 0 retweets 0 likes -
Replying to @volatile_void @ch3root
@RichFelker, I don't think you can deduce that the allocation is not possible. So calloc is free to fail or not.1 reply 0 retweets 0 likes -
C std does a very poor job of making reqs like this 100% clear, but size_t needs to be able to repr any obj size
2 replies 0 retweets 1 like -
Otherwise you would have all sorts of horrible things like wrong results from strlen, strcspn, etc.
2 replies 0 retweets 1 like -
Replying to @RichFelker @ch3root
Sure, I didn't say that I recommend this, but in my POV the optimization is correctly follwing the as-if
1 reply 0 retweets 0 likes
In this limited case, maybe. Regardless of that, it's also being applied in clearly-wrong cases.
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.