Subject: Re: grf_cl.c tested on A2000+Spectrum1MB
To: None <amiga-dev@NetBSD.ORG>
From: Michael L. Hitch <osymh@gemini.oscs.montana.edu>
List: amiga-dev
Date: 02/05/1995 21:01:50
On Feb  5,  9:40pm, "Christian E. Hopps" wrote:
> > >         /* was a break -SG- */
> > >                                 return(0);
> > 
> >   Uh - doesn't a return(0) indicate an error?  This routine looks like it
> > returns 1 if everything is OK.
> 
> Of course with few exceptions functions should return their error status.
> I trust that Michael is correct so I thought I would make the point that
> people (i.e. driver authors) should be returning error states e.g.
> 
> 	return (-1);	/* error */
> 	return (0);	/* no error */
> 
> This is the standard way to do things in NetBSD.

  The return in question is from the *match() routine used during the
autoconfig process.  A zero return indicates that the match was not
sucessful, meaning that the device being configured isn't what the
match routine wants.  A non-zero return indicates a sucessful match,
with the return value being used to choose the best match, although
I'm not aware of anything on the Amiga that would have multiple
matches for a given config search.

  In short, the return(0) indicates the device didn't match what
was being searched, and would not be configured.

Michael

-- 
Michael L. Hitch			INTERNET:  osymh@montana.edu
Computer Consultant
Office of Systems and Computing Services
Montana State University	Bozeman, MT	USA