From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: master 37889523278: Add new `swap` macro and use it Date: Sun, 7 Jan 2024 01:45:54 -0800 Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19413"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 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 10:46:47 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 1rMPjz-0004wH-Pn for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Jan 2024 10:46:47 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rMPjK-0007Ch-5t; Sun, 07 Jan 2024 04:46:06 -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 1rMPjG-0007C9-9i for emacs-devel@gnu.org; Sun, 07 Jan 2024 04:46:04 -0500 Original-Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rMPjC-00088Q-To; Sun, 07 Jan 2024 04:46:01 -0500 Original-Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-555bd21f9fdso963690a12.0; Sun, 07 Jan 2024 01:45:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704620755; x=1705225555; darn=gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=twIBxzvpMTsl7/iqC9KbSDFnb+wKt3WqWXhSQzHlAp0=; b=J7j+ePjw3D5f3IzPQZAMMhTuX4U28uPIQbnCvvkdxn6chSYqG4S+8MAtyXgfEb85MB cd+JHtT4e0lp9SilXvPm44twi9g86qR8mHvEja7M7Gnh5Lp/oyiiZs5vXaEgyzLwZDuZ iRFHX1qx9P+g3pSTysi4aEmo0Wpf4lbVNrHTcdKlt0QTxu18Etoxj7EFouyMaUrba9BW qqxEIvAgv7TBFV2ow3G7SWMkUwj6tpd89qnUBhxI4Jo0Ac7nwG2AaWOoj3fCpkvS1oSP lRcwzTiXRYFbigugSNlSLhnyOSB+/DO6U9GINq2I7ExwAnHwVPzenqf9LvRsbOfrV1lr 89Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704620755; x=1705225555; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=twIBxzvpMTsl7/iqC9KbSDFnb+wKt3WqWXhSQzHlAp0=; b=us7VEB+14jM3C8X5WMwBPQsFH/YL7n74RGoububUAQRvlqZRsyhyEK1+wbS0/+/tXc rYG+8jNagPECGAcpxTkdsIRlyS8rch+sLblG+GNLXwYkSxPKZWR2qxkGkLCPj6QIEXJv PIBOXyza9HLy8Rwjli9FMXxymHc38qZpIlJ8HyULNJ/Ae8dWqmaqAR+m6Ciy92K4s323 tUCGSITRM9uwh3kuSVhm3nQX/18Cu4TYK6j5W7hBvzFLfo1QpnTpqwMCaePuguNQUWdb 3MC5rMd1Fw8bc0uVLrq6epHCYMiPSDIos7HehruGQa0zZyLnUbNxCiQev+c3n87YXuhv v0Fg== X-Gm-Message-State: AOJu0YwFQz5hN+GW9tOOcMoLSA4Parq4qQvZdfr+U97q3DKFNdvl3d62 +Pt4BuTNZW70e5qQ491j4S9flSWOILhuW3dtQfw= X-Google-Smtp-Source: AGHT+IGiNG1rM4ROm8qZF3yW9aTYcJnUhUetny5Nq9d5hRemf6tkt8v3kB6f1heEOGxQqtjQpxL1ok4LUX35VCVQbV4= X-Received: by 2002:a50:cc9a:0:b0:554:489a:2a55 with SMTP id q26-20020a50cc9a000000b00554489a2a55mr1230724edi.10.1704620754800; Sun, 07 Jan 2024 01:45:54 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 7 Jan 2024 01:45:54 -0800 In-Reply-To: <87sf397faq.fsf@yahoo.com> Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=stefankangas@gmail.com; helo=mail-ed1-x52d.google.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, 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:314676 Archived-At: Po Lu writes: > Stefan Kangas writes: > >> That is a serious objection if it is true. But nothing approaching that >> has been shown to be true so far, not in this thread at any rate. > > How is that so? I and Andreas have both demonstrated that in our > respective replies in this thread. The objections I have seen are: 1. "__tmp as a reserved identifier might clash with future implementations" This is true and can be fixed by renaming it. 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. So no, I don't currently see any evidence for the claims that this "cannot be fixed" or is "impossible to implement in C". If there is any substance to that, you will probably have to explain it again. Now, as I have already explained, the macro is certainly less subjectively appealing if we have to manually write out the type every time. In my view it is still a bit better, since we get both more readable code and additional safety on our main targets. (Note that we don't currently use -Wconversion in Emacs.) I'm still open to hearing people's opinion about this, of course.