From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: master 37889523278: Add new `swap` macro and use it Date: Sun, 07 Jan 2024 13:34:53 +0200 Message-ID: <83wmslqsv6.fsf@gnu.org> 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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15436"; mail-complaints-to="usenet@ciao.gmane.io" Cc: stefankangas@gmail.com, emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 07 12:35:58 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 1rMRRZ-0003ia-T2 for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Jan 2024 12:35:53 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMRQp-0005wK-4N; Sun, 07 Jan 2024 06:35:07 -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 1rMRQl-0005vP-Gj for emacs-devel@gnu.org; Sun, 07 Jan 2024 06:35:03 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rMRQk-0003oY-Ny; Sun, 07 Jan 2024 06:35:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Bft7iqsEknlMcwvtYGE1WugZol4vmTGH0p5Xjl6AsJI=; b=RN/v9zga9qoI CDckxm1PsiMWDNUxy6VdB+qAihKysaAvgw5WN+/29vgoRxT8EaxyEHTA+2Mun8HreM81QyMIbSY/D wv3cobibzy5/R/UnTaS7iSLJxTnJNcuEDE8rR7wJRE0VLzeDkW0QPj8kDnpMJjgwMQ6XoN01yHZnE TitNGt59nQJLJxHKmnhkvzy2vqoqILUcfnLa4oeaHlZQD2NWx0MdBExIB7KGlX0AOWn/J720q2RuJ CP4Vp2/jd17gOz8eDaccbCZiKyIfFK6FA7w/uDyPot0lqRFCt582De+tFPhnOvbPVneKKQJYQ28In jbksb27k0A4Z95yWsqN+OA==; In-Reply-To: <87o7dx77mw.fsf@yahoo.com> (message from Po Lu on Sun, 07 Jan 2024 18:36:07 +0800) 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:314679 Archived-At: > From: Po Lu > Cc: Eli Zaretskii , emacs-devel@gnu.org > Date: Sun, 07 Jan 2024 18:36:07 +0800 > > Stefan Kangas writes: > > > 2. "the first argument can easily become out of date without notice" > > > > This is true, but of course only when _GL_HAVE___TYPEOF__. > > > > When !_GL_HAVE___TYPEOF__, > > > > swap (T, x, y); > > > > is subject to the same basic type errors as > > > > T tmp = x; x = y; y = tmp; > > > > If that is not workable, we could, as a last resort, just forego > > using typeof altogether. But at that point, the macro is reduced to > > be mostly aesthetic. > > There are no "basic type errors" inherent in this statement. In most > instances where the type of a variable is modified, it is from one > integer type to another (e.g. long to ptrdiff_t), which means > inconsistencies between the type in the swap statement and the values > being swapped might result in truncation on compilers where __typeof__ > is absent. As they do not emit diagnostics in response to such errors, > bugs so introduced won't appear until the erroneous code is in fact > executed and the values involved are sufficiently large that truncation > produces a visible malfunction; worse yet, such bugs cannot be > discovered by developers using GCC. Please raise these issues with the Gnulib folks, not here. Meanwhile, what's good enough for Gnulib should be good enough for us. > Never in my life have I heard the statements for swapping two variables > characterized as "insufficiently readable" With all due respect, if you don't want your own stylistic preferences to be questioned, please don't question those of others. Let's all respect the preferences of each other, okay?