From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: master 37889523278: Add new `swap` macro and use it Date: Sat, 13 Jan 2024 10:50:29 +0100 Message-ID: <19D721F2-D1FB-4C55-AAB3-B59D695D6958@gmail.com> References: <170452579053.27998.16123231327386305897@vcs2.savannah.gnu.org> <20240106072311.28B8FC0034E@vcs2.savannah.gnu.org> <87plye9ahs.fsf@yahoo.com> <83o7dyua0d.fsf@gnu.org> <83il3xh9xo.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="338"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Kangas , luangruo@yahoo.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jan 13 10:51:08 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 1rOafU-000APc-9m for ged-emacs-devel@m.gmane-mx.org; Sat, 13 Jan 2024 10:51:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rOaf0-000441-4h; Sat, 13 Jan 2024 04:50:38 -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 1rOaex-00043t-Rx for emacs-devel@gnu.org; Sat, 13 Jan 2024 04:50:35 -0500 Original-Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rOaev-0005EQ-QX; Sat, 13 Jan 2024 04:50:35 -0500 Original-Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2cd81b09e83so35158651fa.2; Sat, 13 Jan 2024 01:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705139431; x=1705744231; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=IA6es4Kgdb0Jr786y0cY/OXMHDrFQCpkaTdaaPPNDiY=; b=bKp2GTK/5mXsLC2JWVdmS/9r7P+FI76v8UaP3YZBDuOwYMMGxkoBpR5YIwYVHmMpOy tln3HTqzcKw3b2mwWw6QC9sHUqTxY6E+BblUBAEbMeLd+zsEf68YlpjL8Ca2HnRft5fR XJSxf4gNsuXWKsb9FK8DguB/VManzs7AkpOLMXNKWzmcV73fjbqTPJ4hi8zygqs9Fido wemE5NIH+vQGAfQtopOerbpyTfUaPPdfgv3xTIBcsXvm4Zc2xOVaevNuKXmuM94PndbY YgkFdHVAALWBln0LANVYb7rEfxFqMSmKPDFHbemKcHZsa64mVjE8eSoR4G52q1FXKzzv 1kkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705139431; x=1705744231; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=IA6es4Kgdb0Jr786y0cY/OXMHDrFQCpkaTdaaPPNDiY=; b=teKYS0IgRMEv27BQD17WcbXk9lpnO6sPj4KorzgSqHJmC32mKOjy8tXZ3g4uRWTdnt HARzJTwtIzhSEApDInk8r3/Wgux+JekuH66n3gOj63kUR1Bj/wWx3cFMMvGXyKg9svwl lbBHKj59goRXZZb1g+XQK6qYfkZPHYUE7jmTKbWEg3k5mxtIskdocYNr+lnilMfZPAQy Kw+RK1bMPG3w9jU+ggo7pGJHLgmrV4K10zla3XvrsTGfLGwuiUXoPOXnQFgysc1pry/J M+LIk+h4vXwV6iLa19uWJsX/75Wd9y6+410jF55zH8P8H29E/QjCgPR4XRnLIa+nK6EG lL2g== X-Gm-Message-State: AOJu0YwDHGvz3EAPHA9l1+BbkuhMFRg+RUWiXTzAO8n10wLeDJMaQcwt EtlM+HWHV4YkPslNEGo/z7tLszr02O4= X-Google-Smtp-Source: AGHT+IELgjzM2xd3b8LBeK4VwbhIkoqNt5glm2dSBN/o6Xm7wttTw1yc0L9pY+0F2sxN/7/5kTXa+Q== X-Received: by 2002:a2e:6818:0:b0:2cc:e9e6:e451 with SMTP id c24-20020a2e6818000000b002cce9e6e451mr689218lja.86.1705139430769; Sat, 13 Jan 2024 01:50:30 -0800 (PST) Original-Received: from smtpclient.apple (c80-217-1-132.bredband.tele2.se. [80.217.1.132]) by smtp.gmail.com with ESMTPSA id z15-20020a2e884f000000b002ccbc2a0d43sm747600ljj.47.2024.01.13.01.50.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jan 2024 01:50:30 -0800 (PST) In-Reply-To: <83il3xh9xo.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.15) Received-SPF: pass client-ip=2a00:1450:4864:20::236; envelope-from=mattias.engdegard@gmail.com; helo=mail-lj1-x236.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:314925 Archived-At: 13 jan. 2024 kl. 10.14 skrev Eli Zaretskii : >>> Regardless of portability issues, I think the macro should be called >>> SWAP, upper-case, to avoid clashes with functions. I agree, better use upper case here. It's a convention to alert the = programmer and reader that normal evaluation rules don't apply. After = all, we don't want anyone thinking that SWAP (int, a[i++], a[j++]); is a good idea. (Maybe we can make it work using preprocessor trickery = but I'd rather not at this point.) For that matter, we could add code to verify statically that the given = type agrees with that of both arguments. And I think that a swap macro is useful: in any body of code the = probability of finding the moral equivalent of a botched swap, a :=3D b; b :=3D a; approaches 1 as the code size grows.