public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Jeff Garzik <jeff@garzik.org>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Kernel development list <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Kai Petzke <wpp@marie.physik.tu-berlin.de>,
	"Theodore Ts'o" <tytso@mit.edu>
Subject: Re: Complaint about return code convention in queue_work() etc.
Date: Fri, 18 Aug 2006 15:41:51 -0700	[thread overview]
Message-ID: <20060818154151.e92d4246.akpm@osdl.org> (raw)
In-Reply-To: <44E63476.201@garzik.org>

On Fri, 18 Aug 2006 17:43:18 -0400
Jeff Garzik <jeff@garzik.org> wrote:

> Alan Stern wrote:
> > I'd like to lodge a bitter complaint about the return codes used by 
> > queue_work() and related functions:
> > 
> > 	Why do the damn things return 0 for error and 1 for success???
> > 	Why don't they use negative error codes for failure, like 
> > 	everything else in the kernel?!!
> 
> It's a standard programming idiom:  return false (0) for failure, true 
> (non-zero) for success.  Boolean.
> 
> Certainly the kernel often uses the -errno convention, but it's not a rule.
> 

The predominant convention in the kernel is 0==success and I do think that
the change which Alan suggests would be kinder to the
principle-of-least-surprise.

But if you're going to change the function's return conventions, please
also rename the function.


  reply	other threads:[~2006-08-18 22:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-18 21:39 Complaint about return code convention in queue_work() etc Alan Stern
2006-08-18 21:43 ` Jeff Garzik
2006-08-18 22:41   ` Andrew Morton [this message]
2006-08-18 23:29   ` Alexey Dobriyan
2006-08-19 15:24     ` Alan Stern
2006-08-20  8:27       ` Jan Engelhardt
2006-08-20 16:58         ` Alan Stern
2006-08-20 22:06           ` Jan Engelhardt
2006-08-20 22:36             ` Alan Stern
2006-08-20 11:06 ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060818154151.e92d4246.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=dwmw2@infradead.org \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tytso@mit.edu \
    --cc=wpp@marie.physik.tu-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox