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: Sat, 06 Jan 2024 15:39:11 +0800 Message-ID: <87plye9ahs.fsf@yahoo.com> References: <170452579053.27998.16123231327386305897@vcs2.savannah.gnu.org> <20240106072311.28B8FC0034E@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32396"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Stefan Kangas To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jan 06 08:40:15 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 1rM1Hz-0008JH-35 for ged-emacs-devel@m.gmane-mx.org; Sat, 06 Jan 2024 08:40:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rM1HG-0003wl-8V; Sat, 06 Jan 2024 02:39:30 -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 1rM1HF-0003wd-AW for emacs-devel@gnu.org; Sat, 06 Jan 2024 02:39:29 -0500 Original-Received: from sonic317-34.consmr.mail.ne1.yahoo.com ([66.163.184.45]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rM1HD-0006c7-CN for emacs-devel@gnu.org; Sat, 06 Jan 2024 02:39:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1704526762; bh=Qkl/+mZitFIcsQxfJ4O20xMDsM66vWj/BaJz5F7JAE4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=ZQQTArOFuP2K3PXl3vD6AMgVFKcghnlbDN7R5HyIzri/s+/XkqHc5KLwKqqkZDCTpDs6b0HYH+FDMGCB1vrfW0YqA3/3ieiffj/Ukm4mnpBO/7R98Z35WyhWrgHsAxd0ZP8ZR6u31NC2ksHHtp9jsdF+vxD410QeYAlifr8xtsK6Oxwus2PkwWHsOtaMzF33iMU+SdgtFr34d4q/g6XJ5aDJ5TlkP5NqaiUffMO8FfnrmjOvGwlX3gkH0GYuwvb2eFa8j3fY7t5wGmFW949kf5cjul2hjWe4BoTLlGFAsU+y96XQ13dKwBH2DGLUyQkOJp4Ei4DVRI/6g1DxVuLsDQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1704526762; bh=igkpLZqqI/OY61bUVtMGTDup6OKCSWzDf0bSx56cEin=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=PG9D1Txs1CQFufeassKsIAxENaAm18I9OV0/lbhyFM0T0OlsKumSR9Ih4Ixvxb+t93kpt7TK/+YuMsA+LQXHxHskWUu7qRnvDJPZUMOQg9mE/VPU0M4ewvAUbnlQnuDUVHRNrTM4zak3I0nBHumNTWXQlHPARi1IHro8FtyoDWJ0nPl9SpKTiq+PfPi0eWPUMaiEDwl6jMOMx/P4SA5npmcbccuDKE1RHEyri9vFSMGIGfWrvSTWDof6Uu51262f8JnGm/EIO+Dq4KebE8uX1m59bsr5fC6+zVtJKxWB65wXFRGf46wdERtXWBAnoKA4RBQl2p5iTFAhg1seJ29DPw== X-YMail-OSG: zsACbMMVM1kdipwvDNz2FBl6JMz9eBy2EtenGmspo1lfxMomhZWZAkbh66sW6tw eUyCXBSutlgk37OUmSEMY5LqEfqqKnMAQRobHKmCrbu3rYj3HIDRnYwb5EDz8iFcawSEgOJ7WBOG gKWmD7HDdK.L7Bs.7BTsG3YAoaxXO53dKY2oRcOCBZ8FsTQgJdyES7_2CmlzJRawEBgoAOtXd33S 7b7hx_fNQCitq76f9eFwk5JmqzjbNjm.TSKLiJ5ko57Fks0Y5Eyd6NMRtLFeCFLBrzXzn0sJ9Kbf Ny5AgI41BRovwjQORKbiuqdsG48eRjpWa5ekz8cb3EywP3tMMQLCD4nA_DxYsn06CO1gsPISHvDD aGKmgnvak.1w5AeMkG_LpIiDXwsK9tg3G2i8f2azAxsMC8_kxyPZFsII5v8Rr.d3x6eVA1IzaE1x _iDy2X437zXnf6quMQ3eT2iS06BUHUdjavURBK8yjxq9R3xQfPCWUhs_i8panQT3NKX5H.WsJGkE YxIPWp3at_RF.Bclep7upxRWZ4Qhn2103SZ_7TGZrjk7Ncfz7nu89QCqyoyUgvp9HJkUW3hND..1 jlL9.Sz0ux5aW6c4BJyb8vjHJrtGqeryMvVktLggatplsGAqwT3iblpoAKQXzs0oCUVE2hSATMvs rqZIQ4xpDGRQrlPiFpbGZ5uBN2lv8OA_tmLw2W751x.2mhrwH4SM9KjmLm52L_DxH1OEoFMXjYds JaTlYv9hPKjke2AgNDtCcJNZJQ4vfLBkE3g2f8.VQWsHioqyiRS8gRKvUeETWO1UkVyuoDBbGkVd cPpSL_abyDyL4Svw.3ubtZy_Tb6jIC9eKDACCjw32v X-Sonic-MF: X-Sonic-ID: 57f7c3b1-3575-4cf6-afe9-6c5e1ea63c5f Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.ne1.yahoo.com with HTTP; Sat, 6 Jan 2024 07:39:22 +0000 Original-Received: by hermes--production-sg3-65d57d948b-bq97j (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID b706d6830ec67de7087544fe1155a15f; Sat, 06 Jan 2024 07:39:18 +0000 (UTC) In-Reply-To: <20240106072311.28B8FC0034E@vcs2.savannah.gnu.org> (Stefan Kangas's message of "Sat, 6 Jan 2024 02:23:10 -0500 (EST)") 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.184.45; envelope-from=luangruo@yahoo.com; helo=sonic317-34.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=ham 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:314593 Archived-At: Stefan Kangas writes: > branch: master > commit 37889523278fe65733938fb11c3701898309961c > Author: Stefan Kangas > Commit: Stefan Kangas > > Add new `swap` macro and use it > > A `swap` macro prevents programming errors and is more concise. > It is a natural addition to our existing `min` and `max` macros. It's well known that a generic "swap" macro is impossible to express in Standard C for lack of a standard "typeof"-like expression. To compensate for this limitation, the macro must accept an argument identifying the type of the field where the temporary value is saved, which is more trouble than it's worth and reintroduces the type conversion problems such macros are intended to prevent. Neither typeof nor __typeof__ are portable by our standards, the latter being an extension compatible with the Standard enabled when GCC is configured to obey the standard to the letter, while the former is a keyword enabled in other situations.