News for hackers. Stuff that matters.
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?
Re:About size_t and ptrdiff_t by pmelendez on Tuesday August 18, 2015 @12:42PM (#10080244)
"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.
Re:About size_t and ptrdiff_t by aCthrowa on Tuesday August 18, 2015 @01:25PM (#10080606)
ptrdiff_t is the wrong type for exactly this reason. OP's article is... not good.