[GRASS-dev] Re: About the vector changes

Glynn Clements glynn at gclements.plus.com
Tue Aug 11 16:16:31 EDT 2009


Markus Metz wrote:

> > 2. Add an explicit range check before casting the off_t read from the
> > file to an int. 
> 
> That should only be necessary if there is reason to suspect that the 
> sidx file is not read properly. Hmm, actually that would be a good check 
> for exactly that.

More important than validating the file is that, unless you have
thoroughly analysed the code which generates the sidx file, it won't
be obvious to someone reading the code that the off_t value read from
the file will fit into an int. An explicit check would make it clear.

Source code is meant to be read by humans as well as by compilers.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list