From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: xenodasein--- via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: Thoughts on replacing macros with static inline functions Date: Fri, 18 Nov 2022 07:32:39 +0100 (CET) Message-ID: References: <83r0y4idy8.fsf@gnu.org> <87leo8eq0y.fsf@yahoo.com> Reply-To: xenodasein@tutanota.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15731"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "xenodasein--- viaEmacs development discussions." , Richard Stallman , Eli Zaretskii , pappasbrent@knights.ucf.edu To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 18 07:33:08 2022 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 1ovuvz-0003sY-Vx for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Nov 2022 07:33:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovuvd-0002Cm-Kv; Fri, 18 Nov 2022 01:32:45 -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 1ovuvb-0002CS-9x for emacs-devel@gnu.org; Fri, 18 Nov 2022 01:32:43 -0500 Original-Received: from w4.tutanota.de ([81.3.6.165]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovuvZ-0006In-Mx; Fri, 18 Nov 2022 01:32:43 -0500 Original-Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id 3B95A1060210; Fri, 18 Nov 2022 06:32:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1668753159; s=s1; d=tutanota.de; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=B/x/iJ7E4Xkl7Q+qPy8qDSFD4m/DX2vrVDRBqpOkDi4=; b=gS1fPPamYlgY/GNI+6ay16q4QnID1/DK5SNpMGfwloP81x3Oj57TxyDGuGZfdjrd PhxB9948ZS3bUKMxZnJXgBFPFJRMRfa1pdQ9Kfb9+tNkBiGd/f0PJnsJskgPS/bNT4J rEUD7Ned7qFEQvwSNGD/MCs58B9HRLcnF0omHjMqQsunp+/e6BouHWSktiA75BLjuAf 6BkZa695n7qN6Utusufj5HB954hX4RHQtwSfVbVNuImoE76ciRgMuH0OF8yTSlQm5sd f9DM+P/jIeUq4UqcNUviIlVk2nYLXjrOj6SVNg6cgYuIyfZOOuOk0zkPG4ysS7UztcG VV6uW7VVNg== In-Reply-To: <87leo8eq0y.fsf@yahoo.com> Received-SPF: pass client-ip=81.3.6.165; envelope-from=xenodasein@tutanota.de; helo=w4.tutanota.de 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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:300084 Archived-At: Nov 18, 2022, 06:27 by luangruo@yahoo.com: > xenodasein--- via "Emacs development discussions." > writes: > >> Why do you not consider __attribute__((always_inline)) an improvement >> over macros where applicable? >> > > And exactly where is __attribute__((always_inline)) present? Only on > GCC, right? What about Sun C, and other C99 compilers? > > And how is an additional function an improvement over extremely trivial > macros, like these: > > #define XM_DRAG_REASON(originator, code) ((code) | ((originator) << 7)) > #define XM_DRAG_REASON_ORIGINATOR(reason) (((reason) & 0x80) ? 1 : 0) > #define XM_DRAG_REASON_CODE(reason) ((reason) & 0x7f) > > ? > Lookup why functions are considered an improvement over macros. As for compiler support, I bet the time spent debugging where there is support is going to dwarf where isn't, so trade-off is clear.