[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ptrdiff_t misuse
From: |
Paul Eggert |
Subject: |
Re: ptrdiff_t misuse |
Date: |
Fri, 06 Jul 2012 08:56:04 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 |
On 07/06/2012 08:43 AM, Eli Zaretskii wrote:
>> But not every use of ptrdiff_t is for buffer and string positions.
>> > Bitmap table sizes, for example.
> Do they really need to be large?
In some cases yes -- certainly in the memory allocators.
Maybe in some cases not, but nobody has taken the time
to think about it, and in the meantime ptrdiff_t is safer.
Generally speaking, if an object can grow and its size
is not limited for other reasons to INT_MAX-or-less,
code should not use 'int' to count its size.
> What for? they span the same range of values.
Yes, that's the point -- if ptrdiff_t and EMACS_POS
would span the same range of values, why bother to
distinguish the two? Whether a value is a
buffer position is usually clearly stated in the
variable name.
- Re: ptrdiff_t misuse, (continued)
- Re: ptrdiff_t misuse, Eli Zaretskii, 2012/07/06
- Re: ptrdiff_t misuse, Stephen J. Turnbull, 2012/07/06
- Re: ptrdiff_t misuse, Eli Zaretskii, 2012/07/06
- Re: ptrdiff_t misuse, Stephen J. Turnbull, 2012/07/06
- Re: ptrdiff_t misuse, Eli Zaretskii, 2012/07/06
- Re: ptrdiff_t misuse, Stephen J. Turnbull, 2012/07/06
- Re: ptrdiff_t misuse, Paul Eggert, 2012/07/06
- Re: ptrdiff_t misuse, Eli Zaretskii, 2012/07/06
- Re: ptrdiff_t misuse,
Paul Eggert <=
- Re: ptrdiff_t misuse, Eli Zaretskii, 2012/07/06
- Re: ptrdiff_t misuse, Dmitry Antipov, 2012/07/06
- Re: ptrdiff_t misuse, Paul Eggert, 2012/07/06
- Re: ptrdiff_t misuse, Chong Yidong, 2012/07/06