[GRASS5] segment lib speed patch

Hamish hamish_nospam at yahoo.com
Mon Jun 27 19:19:32 EDT 2005


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?

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; ??


slightly confused,
Hamish




More information about the grass-dev mailing list