On Sunday 30 December 2007 20:13:31 Thorsten Haude wrote:
> * Ivan Skytte Jørgensen wrote (2007-10-16 01:14):
> >The attached patch changes utils/utils.*:PrependHome() from using plain
> > int to describe the size of the buffer to size_t. The change is
> > propagated up to file.c where it is called.
>
> Why do you want to use size_t for a path length?
Because length of strings, size of arrays, size of objects, etc. are best done
with size_t because size_t is guaranteed to have to important
characteristics:
- large enough to hold any size of any object in memory.
- unsigned.
On 64-bit systems (LP64 model that is) compiler+lint warn about loss of
precision if a plain int is used. flexelint also complains about possibility
of negative sizes. The patch changes the type to size_t and propagtes it up
to a point where a human easily can verify that a negative size will enver
occur.
The likelyhood of a 4 billion character path name is zero, but that is not the
point. The point is to use the correct type.
Regards,
Ivan
--
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop