[GRASS-dev] etc file finder, take 2
glynn at gclements.plus.com
Wed Apr 18 23:36:59 EDT 2007
William Kyngesburye wrote:
> That all works nicely. thanks.
> For the const char * arg in G__find_etc() - should I also do that for
> the public version of this, G_find_etc()?
Yes. When passing a pointer as an argument, if the function doesn't
modify the data, the "const" qualifier should be used.
I've recently gone through libgis and added "const" wherever it is
applicable, so if a libgis function *doesn't* use "const" for a
pointer argument, then it modifies (or may modify) the value.
Eventually, I'll get around to doing the same for other libraries.
Note that certain structure types almost never have the "const"
qualifier, even for "read" operations, e.g. the Categories, Colors,
and Quant structures. This is because they contain fields which are
initialised "on demand". E.g. a call to G_get_color() etc will
eventually call G__organize_colors(), which initialises the lookup
tables if they haven't already been initialised.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev