[GRASS5] segment lib speed patch
Brad Douglas
rez at touchofmadness.com
Mon Jun 27 19:49:52 EDT 2005
On Tue, 2005-06-28 at 11:19 +1200, Hamish wrote:
> Markus wrote:
> > + return -1;
>
> For a long time I have wondered what is best to use for return codes;
> most modules return 0 for success as per UNIX norms, library fns return
> all sorts of things, e.g. often 1 for true, etc.. glibc has the same
> issues with e.g. strcmp(), and I understand is_foo() returning
> TRUE/FALSE.
>
> esp. for all the if(G_parser()) exit(-1); statements in the modules.
> Should that really be -1 or just 1 or does it matter?
Isn't it best to use EXIT_FAILURE/EXIT_SUCCESS to avoid idiosyncrasies
between implementations?
> It would be nice if we had something standard we could put in the
> SUBMITTING file. (e.g. action fn()s return 0 on success, test fn()s
> return 1, or something like that?)
>
> Specifically: should we avoid return -1; ??
For normal functions that return int, I generally return -1 if some sort
of error function has been set, but return 0 otherwise. I don't know
how applicable that is to GRASS, off hand.
--
Brad Douglas <rez at touchofmadness.com>
More information about the grass-dev
mailing list