Re:About size_t and ptrdiff_t
by colomon on Tuesday August 18, 2015 @12:38PM
(#10080209)
Also, why use the signed ptrdiff_t for a loop index that is never negative?
[ Parent
| on HN ]
"size_t can store a pointer, it is better to use another unsinged integer type uintptr_t for that purpose "
So he is actually recommending the unsigned version. Although there are some people (like the Google guidelines for C++) that recommend not using unsigned types because of overflows (which is arguable but it is a point)
Re:About size_t and ptrdiff_t
by benmmurphy on Tuesday August 18, 2015 @12:41PM
(#10080223)
I thought using signed indexes in loops allow GCC to perform some optimizations because signed overflow is undefined.