Simon Large <simon@skirridsystems.co.uk> wrote:
> Юрий Першин wrote:
> > How did you made this ???
>
> What is wrong with the original? We are comparing string lengths, not
> string addresses. strlen() returns size_t not ptrdiff_t.
> Am I missing something?
Juri is right. When I made the patch (I'm not sure,
if that has actually been mine), I was not aware that
pointer differences have their own type. ptrdiff_t is
signed, size_t is not.
Since this difference is important only when comparing
expressions (like "if (diff < 0)" ) they should be
interchangeable in most places.
I think the proper use is
* size_t for absolute addressing (maily indices)
* ptrdiff_t for relative addressing (mainly pointer arithmetics)
Just my 0.02€.
Stefan.
Received on Wed Aug 24 13:55:13 2005