What requires this calloc call to fail? C11? POSIX? For all sizes > PTRDIFF_MAX? Or > SIZE_MAX?
-
-
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 -
Replying to @RichFelker @solardiz
I consider this a bug in compilers. Which would be nice to fix. This is not a requirement of some standard.
2 replies 0 retweets 0 likes -
Supporting objects >PTRDIFF_MAX rather than ensuring they don't exist is a QoI bug even if not a conformance issue.
1 reply 0 retweets 0 likes -
The - operator is not safe to use on pointers unless the implementation precludes objects > PTRDIFF_MAX.
2 replies 0 retweets 0 likes -
So I agree there's a bug that needs to be fixed, but the proper fix is ensuring the offending objects can never arise.
1 reply 0 retweets 0 likes -
Replying to @RichFelker @solardiz
So all objects in all programs are to be restricted to <=PTRDIFF_MAX due to a potential problem of the - operator\
1 reply 0 retweets 0 likes -
with large arrays of chars in some programs. Doesn't look like a proper fix to me.
1 reply 0 retweets 0 likes -
Not "some programs". Due to complete inability to use an operator that's widely used and should be usable.
1 reply 0 retweets 0 likes -
"This operator works, but it could overflow & yield UB, & you have no way of testing it does" = bug in C standard.
1 reply 0 retweets 0 likes
Any non-crap implementation of C will avoid this bug simply by not generating cases that can overflow.
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.