>>27 hi lambda, this is offtopic but since I saw you I want to ask, what's the point of ptrdiff_t? why not size_t? it seems the same to me
Name:
Anonymous2014-04-27 10:56
>>32 ptrdiff_t has to be a signed integer. really_large_unsigned_integer - really_low_unsigned integer = overflow when stored in a signed integer of the same width In practice they're probably the same size on most platforms, since the only way you could get an overflow is by taking the difference of a pointer in kernel space (really high) and user space (really low), and that is not something that you'd ever need to do, but I see where da standed was going with it.
>>33 I though that ptrdiff_t was for subtracting pointers to the same object
Name:
Anonymous2014-04-27 11:36
>>34 You could also use it to compare two objects in a heap, two array indices, etc. Like I said, not a problem on typical 32/64 bit OSes, but imagine a microcontroller or DSP with a 24 or even 16-bit address space. You could easily have an array or heap on such a platform whose length will not fit into a pointer-sized signed integer.