Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79908 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25378 invoked from network); 24 Dec 2014 05:18:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Dec 2014 05:18:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.217.174 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.217.174 mail-lb0-f174.google.com Received: from [209.85.217.174] ([209.85.217.174:57517] helo=mail-lb0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/00-25055-6AC4A945 for ; Wed, 24 Dec 2014 00:18:31 -0500 Received: by mail-lb0-f174.google.com with SMTP id 10so6328348lbg.19 for ; Tue, 23 Dec 2014 21:18:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=EWwQpXrKtkwI7/bdBAtYpg+c+ukC6+4kWt6rdMd6KAw=; b=Bt8V/k4uB2sdoauxllTwVmSyq5oE7TtBOIf+FatfC+Q1V7JoXG03Ss+4DWCX3DLf/l V1UPr2cos9bSfsQcCwT2QqoFtgHRo9BdYfOUPAh3P00FfukywQdN9ZS0XqDEHqMhrTGI VgwfF3/QuLpSmKiCVParqs48YNtiMMGCku9mRWJmOs7LQC1EcIV0AKJhGX6fveORPwMw 0KySsLIGsPIX8LF4UHiJZPCY67xIVtdPtb2MOo/cGXtJ8LFD+a2YlQxw41XQwJR/tW5U R8HhnrRQb2qUI0X+55k52qAR7a/K2jNgPa0cDwmKsy1QTdcp/AkvXPVK0mqzEMOFigLb Tq3w== X-Gm-Message-State: ALoCoQmoaYYC1y+1DePFzWdZ1Ac6OgBwRjkJcg8T1B383SbW9UNu53PEKf5bSU3R2fGsEqARplfxGWssmMGy/EU5xq9KKLxSPahH1bg1t3b/sZDpMPKlsbcun8Q9VmwsBxE3gyFzdnPswtU025cBFJ6tKAfeQTFJ5Q== X-Received: by 10.112.35.234 with SMTP id l10mr32272837lbj.12.1419398307764; Tue, 23 Dec 2014 21:18:27 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPSA id zp3sm6368925lbb.45.2014.12.23.21.18.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Dec 2014 21:18:26 -0800 (PST) Received: by mail-lb0-f172.google.com with SMTP id u10so6349316lbd.31 for ; Tue, 23 Dec 2014 21:18:25 -0800 (PST) X-Received: by 10.112.17.102 with SMTP id n6mr31441637lbd.39.1419398305984; Tue, 23 Dec 2014 21:18:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.64.176 with HTTP; Tue, 23 Dec 2014 21:18:05 -0800 (PST) In-Reply-To: <946C1B1D-30B8-4029-A5A1-73D515A017D8@ajf.me> References: <946C1B1D-30B8-4029-A5A1-73D515A017D8@ajf.me> Date: Wed, 24 Dec 2014 13:18:05 +0800 Message-ID: To: Andrea Faulds Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] About SUCCESS/FAILURE From: laruence@php.net (Xinchen Hui) Hey: thanks, that is the first thought of mine too. On Wed, Dec 24, 2014 at 1:06 PM, Andrea Faulds wrote: > >> On 24 Dec 2014, at 03:25, Xinchen Hui wrote: >> >> Hey: >> >> We use SUCCESS/FAILURE as return value in some APIs, but use >> 0/1(false/true) in others. >> >> I'd like to remove SUCCESS/FAILURE at all, use 0/1 instead.. >> >> what do you think? >> >> 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; > For now, we can not tell what the function return to represent status from the declaration , since they all return int. int func(); we have to looks into the source code to get what it used. so change int func() to zend_success func() may help some bits. But: return 0 and return FAILURE... which is simpler? thanks > Thanks. > -- > Andrea Faulds > http://ajf.me/ > > > > --=20 Xinchen Hui @Laruence http://www.laruence.com/