Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79926 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99435 invoked from network); 24 Dec 2014 18:16:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Dec 2014 18:16:54 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:52084] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/68-50910-6130B945 for ; Wed, 24 Dec 2014 13:16:54 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 2230A8800A2; Wed, 24 Dec 2014 13:16:51 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Xu3wQySpRrue; Wed, 24 Dec 2014 13:16:50 -0500 (EST) Received: from [192.168.0.13] (unknown [94.13.96.117]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id A45AC8800FA; Wed, 24 Dec 2014 13:16:49 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: Date: Wed, 24 Dec 2014 18:16:17 +0000 Cc: Pierre Joye , =?utf-8?Q?Johannes_Schl=C3=BCter?= , PHP internals , Laruence Content-Transfer-Encoding: quoted-printable Message-ID: References: <946C1B1D-30B8-4029-A5A1-73D515A017D8@ajf.me> <1419428487.29904.6.camel@kuechenschabe> <5E26F21C-EA41-43FF-8DDB-D0A985AB4197@ajf.me> To: Levi Morrison X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] About SUCCESS/FAILURE From: ajf@ajf.me (Andrea Faulds) > On 24 Dec 2014, at 18:13, Levi Morrison wrote: >=20 > On Wed, Dec 24, 2014 at 10:34 AM, Andrea Faulds wrote: >>=20 >>> On 24 Dec 2014, at 17:22, Levi Morrison wrote: >>>=20 >>> Hmm. This thread doesn't seem to mention it, but why must failure be >>> negative? I understand the non-zero part but not negative. Aside = from >>> the fact we probably have code relying on it to be negative at this >>> point is there some other reason? >>=20 >> Hey Levi, >>=20 >> I believe it's a convention among C APIs: 0 for success, negative for = some error >=20 > I'm asking for specific things. The reason is that some API's do a > non-zero error code; the fact that they are negative is a detail that > we should not need to care about. Actually, that email was cut off: unfortunately iOS doesn=E2=80=99t = require confirmation to send an email and my finger slipped. The main point of negative values AIUI, is that you can return useful = information for positive or zero values and error codes for negative = values. For example with strpos(). For some APIs you only need 0 and -1, = mind you, but being able to do if (foo() < 0) for everything is pretty = neat. -- Andrea Faulds http://ajf.me/