3 ms·
Nitpicks: "ptrdiff_t type...ptrdiff_t will take 32 bits, on a 64-bit one 64 bits" -- that's not really true as that would made it equivalent to size_t. So in r
by pmalynin 11y ago
Nitpicks:
"ptrdiff_t type...ptrdiff_t will take 32 bits, on a 64-bit one 64 bits" -- that's not really true as that would made it equivalent to size_t. So in reality its 31 bits and 63 bits.
- gjm11 11y agoNope. It's 32 and 64, but it's a signed type (which is why it isn't equivalent to size_t). The range of possible values is still of size 2^32 or 2^64, it's just centred at 0. [EDITED to add: Having said which, the above isn't really any wronger than the OP which is full of mistakes.]
- pmalynin 11y agoWhat I meant to say is that the text for size_t and ptrdiff_t are identical, implying that the underlying types are identical. That is there is logical fallacy. They author states "The type’s size is chosen so that it could store the maximum size of a theoretically possible array of any type" and the same is said for ptrdiff_t, which is quit confusing. Now I realise that in reality they both use 64 bits, it is somewhat strange to use the same text for both.
- gjm11 11y agoYeah, the article is just terrible, and when it says a ptrdiff_t can store the size of any object it's completely wrong.