From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: master 37889523278: Add new `swap` macro and use it Date: Mon, 08 Jan 2024 10:15:02 +0800 Message-ID: <87o7dw6061.fsf@yahoo.com> References: <170452579053.27998.16123231327386305897@vcs2.savannah.gnu.org> <20240106072311.28B8FC0034E@vcs2.savannah.gnu.org> <87plye9ahs.fsf@yahoo.com> <83o7dyua0d.fsf@gnu.org> <87le9297ei.fsf@yahoo.com> <87cyue92fx.fsf@yahoo.com> <877ckm8uzz.fsf@yahoo.com> <83v886sgtl.fsf@gnu.org> <83plyescg9.fsf@gnu.org> <87wmsl7wh9.fsf@yahoo.com> <87sf397faq.fsf@yahoo.com> <87o7dx77mw.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16525"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 08 03:15:44 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rMfB2-0004AN-L1 for ged-emacs-devel@m.gmane-mx.org; Mon, 08 Jan 2024 03:15:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMfAc-0002TA-N3; Sun, 07 Jan 2024 21:15:18 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMfAc-0002T2-0o for emacs-devel@gnu.org; Sun, 07 Jan 2024 21:15:18 -0500 Original-Received: from sonic304-22.consmr.mail.ne1.yahoo.com ([66.163.191.148]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMfAZ-0006um-Td for emacs-devel@gnu.org; Sun, 07 Jan 2024 21:15:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1704680113; bh=BcT+pAevt9PBhImHy7QABzZFeEZz8HDVSSSkBHYrPtU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=LxrJfrUu7AFlfpXw/WPTDO5SwLtsbY1MFOk29KgdiSjN/eA4Oaf+6udSHVA2PHpMovCrP5wh9RpMKYSqlUgfxrQ/87WyGHkcSyd/cCakvnhTJqFifIwXS7bsXv/p1TMxMeoOPs3l/MqebxExJnIkAhQXYIWJla6NVXY66gMnIm6W8ipfJS4nbma75oHXYKzy+v4Nl3ZqZ4kNBFFYgKQnYltPEXOTfN6nk0UOgVvfOaR5DSUk5CaoHTp7CE5Dk0kOkGdaJfzHe9MIiQbvwDAkHwgT1zqHLZJmBazPrphwbO6FqRSA+StNt47kcx6rsvlTstEeQeu2sjRh+Y4CKKtDnw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1704680113; bh=nGfmyashy5IWcRAIvO82jSl7n4OrdfZZujjlAUfcanW=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=CdrtANQotF2nRoLtLrFwMmJQ5Eky3KKMRjIyxfYMuo4v/8UC4g/v01OEnzmIhpbXNKOng8aodVllfbR0o27DPeRuF52FdevbI7QrKKT/Zirk2NDHPiPSgFO435xcdM2SRIouEqSaF/SwMSTrVR/wN3KlSIZPz2yk+20OQSuzBY/7mtRAtRkp31oQn51crCjO9BeQgjpX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gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ne1.yahoo.com with HTTP; Mon, 8 Jan 2024 02:15:13 +0000 Original-Received: by hermes--production-sg3-65d57d948b-ngz7m (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID b573d3a8c29b869da40796ede48b4dce; Mon, 08 Jan 2024 02:15:07 +0000 (UTC) In-Reply-To: (Stefan Kangas's message of "Sun, 7 Jan 2024 09:32:25 -0800") X-Mailer: WebService/1.1.21952 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.191.148; envelope-from=luangruo@yahoo.com; helo=sonic304-22.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:314716 Archived-At: Stefan Kangas writes: > Anyways, the comp.lang.c FAQ entry you quoted here does not discuss the > typeof operator. That has been changed in more recent versions. It makes unambiguous reference to the bearing of typeof: 10.3: How can I write a generic macro to swap two values? A: There is no good answer to this question. If the values are integers, a well-known trick using exclusive-OR could perhaps be used, but it will not work for floating-point values or pointers, or if the two values are the same variable. (See questions 3.3b and 20.15c.) If the macro is intended to be used on values of arbitrary type (the usual goal), it cannot use a temporary, since it does not know what type of temporary it needs (and would have a hard time picking a name for it if it did), and standard C does not provide a typeof operator. ------ Nothing in this respect has changed since this was written: Standard C won't provide a typeof operator until later this year, and it will be decades before it will be universally available to programs. For that matter, what are we arguing over? Is it really this hard to agree on the two facts that typeof is not portable, by our standards of portability (C99, and various operating systems), and macros with which invocation errors cannot be detected except on a handful of little-tested systems are liable to produce many such errors, much like GCPRO once did? Both statements have been accepted wisdom where C development is concerned for quite a while now, and we have direct experience with the latter, which was reason enough to remove the problematic macro.