Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126237 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 9E2951A00BC for ; Thu, 30 Jan 2025 09:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1738227579; bh=UQ++sSJ/TOL4ZHaxE7B9L7mczloZk24FbX9/QV6jHV4=; h=Date:From:To:Subject:In-Reply-To:References:From; b=erZEjWPr1cnP1vnpQzJlxIPuRSw7iD9H/BJJUq1VvMIfXjnbkvE7QjFpQomaEL525 lFULrgwSZSUTj7SmEtyNMFyQeYvJy4edt08gzg1CqecZC/bBszUVmQw95zz4131dQX eFYhXRgyfzIZ6RQxq2fMrOtyWtVsf+83Ilo9dyLIKAb81CmARnB2u8h2KuDIGqpOj3 v8+bH+5jsUKBmPzN2dG9zY8/YG0xNY3GFB0sjp1USRArw4li2+1kOiWUPEvmJ5sQ9j N/5sVMekbCAS3U53tjUEA9SxtHGRxIMz5VJunQwyenh7VuKMvDugK9vCWox2afpN/p 0211FcN+xHMJA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ABA3518006A for ; Thu, 30 Jan 2025 08:59:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 30 Jan 2025 08:59:38 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 989F01140106 for ; Thu, 30 Jan 2025 04:02:25 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 30 Jan 2025 04:02:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1738227745; x=1738314145; bh=UQ++sSJ/TOL4ZHaxE7B9L7mczloZk24FbX9/QV6jHV4=; b= FucL15WReK5V4jgnaNibNktDcP1pzJpgejpSsQNsBdWyb/OwtZJlUjhrvvjfoELO 6ypiY6ID5E5Z3IxaS3Pf/i5RnHm+zfuw9AzbNeKQCHRkfkbaFA5hdWWac92Xg+9w EfVj3irdj+ojidM+xcoxR51gHW3fw6CLJEgg6/dFr+ato6IYjszmye5oym708LcO epBkqiEk2EVW4OwM9CryP9SfBpf0ZrzmqMs+8frKMUlPjc3vx/O6tVE3UsMlohsK 8NzS62q6WhagyzCfOZi2Z6gcD3nNJN6VDDWlMKckAJ4bceUCGko5PVEfYBKd066q 9ZTww292j/mimfWmNmtxnw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1738227745; x=1738314145; bh=U Q++sSJ/TOL4ZHaxE7B9L7mczloZk24FbX9/QV6jHV4=; b=PfybfIPV/GqsQQ+FQ +uhgglJYpNO5xk5Dl6brs4cGhr7DViHPWD/aMJWMRVySM/iXXDR0AvhW0KihrJUW 99FWHdvYxMTpUegAmc2j7WVDY6n8XWnbw+E0Sw02hYK2R6mLGULX6oT7Naz+m/CS GjF906sTYsm7S82gA3ezqei6AeKoYdCbCusvKGXJ4MNv4/PDPDkSpDYS00TqOsqh Q1zA2n+NxX0aoSeCEccsUbliBLkbJSIqNj8egFEknm2Vz/Jsui2hVsrueFSTVz9y qcHn5wBbXnvNSjqffbMyqCMFrhSrUFLxXyI1M784w1RTEJzUugc094oYLkUVcu3i ZqO/w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdehgedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvffufggjfhfkgggtgfesthhqmhdttderjeen ucfhrhhomhepfdftohifrghnucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehimhhsoh hprdhphhhpsehrfigvtgdrtghordhukheqnecuggftrfgrthhtvghrnhepheelffetiefg veduteefudegtdduveeludegueegleehiefhhefgtdekveevgfelnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrphhhphesrhif vggtrdgtohdruhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 30 Jan 2025 04:02:24 -0500 (EST) Date: Thu, 30 Jan 2025 09:02:21 +0000 To: php internals Subject: Re: [PHP-DEV] RFC: Marking return values as important (#[\NoDiscard]) User-Agent: K-9 Mail for Android In-Reply-To: References: <3f170549-cfd6-441e-b892-cf51d726dbe8@bastelstu.be> <3b4d9be8-9255-44ab-95c5-ea3045212cf4@app.fastmail.com> Message-ID: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 29 January 2025 22:48:03 GMT, Christian Schneider wrote: >I think the (void) cast is familiar for people from C or the like, the on= ly caveat is that it is not backward compatible, i=2Ee=2E code using it won= 't work on older versions of PHP so migrating to it is not seamless, so it = probably should not be used for a while in public libraries / packages=2E I suspect that a majority of PHP users will probably have had no experienc= e in C, which is easy to forget on this list where we're working on a C cod= ebase=2E In C, "void" has various uses in the type system, but in PHP this = would effectively just be a specific keyword for this case=2E I think it would be good to explore alternatives - for instance, I think C= # has a reserved _ variable to assign discarded results to, but may be misr= emembering=2E >but my question is whether $_ =3D outer() and nop(outer()) will be guaran= teed to not being optimized in a way which causes the warning to reappear= =2E I don't know much about the optimizations being done but this could be = an issue in the future, no? I second this concern: having code that you think has suppressed the warni= ng later be optimized and start warning could be very confusing, and given = the backwards compatibility issue, users will need something other than "(v= oid)" which is reliable=2E My other thought reading the proposal is that if this can be done efficien= tly, can we use the same approach to warn when a "void" function's return *= is* used? Regards, Rowan Tommins [IMSoP]