Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79907 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23572 invoked from network); 24 Dec 2014 05:06:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Dec 2014 05:06:52 -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.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:60700] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AD/22-10609-AE94A945 for ; Wed, 24 Dec 2014 00:06:51 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 83C0E2400C7; Wed, 24 Dec 2014 00:06:48 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id sLHjc7bZ8cYL; Wed, 24 Dec 2014 00:06:48 -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 D07F92400A9; Wed, 24 Dec 2014 00:06:47 -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 05:06:14 +0000 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <946C1B1D-30B8-4029-A5A1-73D515A017D8@ajf.me> References: To: Xinchen Hui X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] About SUCCESS/FAILURE From: ajf@ajf.me (Andrea Faulds) > On 24 Dec 2014, at 03:25, Xinchen Hui wrote: >=20 > Hey: >=20 > We use SUCCESS/FAILURE as return value in some APIs, but use > 0/1(false/true) in others. >=20 > I'd like to remove SUCCESS/FAILURE at all, use 0/1 instead.. >=20 > what do you think? >=20 > thanks Hi, Honestly, I don=E2=80=99t think SUCCESS and FAILURE are bad, they make = it explicit that some operation is taking place. But using int as the = return type seems odd, maybe we could add some zend_ type for this, = maybe an alias of zend_bool? Similarly, though zend_uchar seems to be what=E2=80=99s used most of the = time to store the return value of Z_TYPE(), maybe something like = zend_type might be good. In fact, this is exactly what enums do, maybe we should use one: typedef enum _zend_success { FAILURE =3D 0, SUCCESS =3D 1 } zend_success; Thanks. -- Andrea Faulds http://ajf.me/