[GRASS5] Function return codes (a thread from the programmer's manual thread)

Markus Neteler neteler at geog.uni-hannover.de
Tue May 30 06:54:45 EDT 2000

On Mon, May 29, 2000 at 05:33:04PM +0200, Andreas Lange wrote:
> Hi Rich,
> Rich Shepard wrote:
> >   This seems like a good time to switch to a consistent system. Zero could
> > represent success, -1 represent failure (for whatever reason), and other
> > return codes could be tested in context. That is, if a file handle is to be
> > returned, then that's what the int represents. If you are trying to open a
> > file, then only 0 and -1 are possible return options.
> > 
> I think there will be no overall consistent system. The return values
> used now are consistent within the system used. There are functions
> which use an int retval only for error handling (returning 0 on error, 1
> on success), others use int retval to return an index or filedescriptor
> (returning neg. val. on error, pos. fd/index on succes), and still
> others use the described system from stdin. You can not simply change
> the semantics of these functions without a complete re-design of the
> library. 
Here I agree - we should be careful and keep running libraries
> As Bernhard said, this should simply be documented.
I will start next week to update further pages within the Prog. Manual.
While updating I will cross-check with the sources to keep
both into sync.

> My main idea is to encourage everyone to stick to a consistent coding
> style and to use a linter and gcc -Wall on the new code to prevent
> future problems. Coding in an open software project has different
> considerations than coding in an institution where the authors are
> present all the time.
I would be happy to insert a small text on programming style to
put this into the Prog.-Manual. 
Who is willing to write it? Maybe just start with a set of rules,
a text may evolve later.
> Now i will switch back to "cleaning up" the coordinate conversion
> library,
Thanks Andreas!

Best wishes


If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'

More information about the grass-dev mailing list