Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119574 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 24023 invoked from network); 19 Feb 2023 08:21:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Feb 2023 08:21:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B803E18033A for ; Sun, 19 Feb 2023 00:21:24 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 138.201.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from swift.blarg.de (swift.blarg.de [138.201.185.127]) by php-smtp4.php.net (Postfix) with ESMTP for ; Sun, 19 Feb 2023 00:21:23 -0800 (PST) Received: from swift.blarg.de (swift.blarg.de [IPv6:2a01:4f8:c17:52a8::2]) (Authenticated sender: max) by swift.blarg.de (Postfix) with ESMTPSA id 847A14109B; Sun, 19 Feb 2023 09:21:22 +0100 (CET) Date: Sun, 19 Feb 2023 09:21:21 +0100 To: Nikita Popov Cc: internals@lists.php.net Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [PHP-DEV] What's the purpose of zend_result? From: max+php@blarg.de (Max Kellermann) On 2023/02/19 08:56, Nikita Popov wrote: > If you have a function like zend_stream_open_function(), SUCCESS and FAILURE are directly meaningful values. Agree, but that doesn't explain why FAILURE needs to be negative. > The current guideline for use of bool and zend_result in php-src is that bool is an appropriate return value for "is" or "has" style functions, which return a yes/no answer. zend_result is an appropriate return value for functions that perform some operation that may succeed or fail. What does the return value of these functions mean? - zend_make_printable_zval() - zend_make_callable() - zend_parse_arg_bool() - zend_fiber_init_context() - zend_observer_remove_begin_handler() - php_execute_script()1 If I understand the guideline correctly, then those examples (and countless others) are defective and should be fixed, correct? Max