[GRASS-dev] Re: g.gui

Glynn Clements glynn at gclements.plus.com
Tue Feb 12 15:02:51 EST 2008


Hamish wrote:

> Also that calls G_store() before G_parser(), and G_store() calls
> G_malloc() which can call G_fatal_error(), which must not be called
> before G_parser() has been called.

Note that G_define_option() also calls G_malloc(), and
G_define_option() only makes sense *before* calling G_parser().

G_malloc() and G_fatal_error() are among a handful of functions which
can legitimately be used before calling G_parser().

Bear in mind that many modules do far worse things before calling
G_parser() (e.g. calling complex functions to get default values for
options). A few don't call G_parser() at all.

One thing which I have been considering for 7.x is to add tests to a
handful of core functions to generate a fatal error if they are called
before G_parser(). The functions which would be affected are those
which read the $GISRC, VAR and WIND files.

That should be enough to prevent use of any more substantial functions
without interfering with utility functions such as G_malloc(),
G_store() etc.

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


More information about the grass-dev mailing list