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: Thoughts on replacing macros with static inline functions Date: Fri, 18 Nov 2022 14:00:30 +0200 Message-ID: <83leo8bhgh.fsf@gnu.org> References: <83r0y4idy8.fsf@gnu.org> <87leo8eq0y.fsf@yahoo.com> <83wn7sbqz4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9060"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, emacs-devel@gnu.org, rms@gnu.org, pappasbrent@knights.ucf.edu To: xenodasein@tutanota.de Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 18 13:01:12 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 1ow03U-00029U-BM for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Nov 2022 13:01:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ow02p-00038t-Ja; Fri, 18 Nov 2022 07:00:31 -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 1ow02m-000361-Fj for emacs-devel@gnu.org; Fri, 18 Nov 2022 07:00:29 -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 1ow02l-0007Ky-Fv; Fri, 18 Nov 2022 07:00:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=pcVgGqbJrJeRu3uWzHw42olioWj9zmMzCRr+fovOrsU=; b=D2ERDkrwo74L1FsHa4Uy INFt4iga3wlSYT8PnhbeaIQ8qoDC1r88z8rvtxdjtL+074bPX9/tqXENTKazgKr1S7/XTjuTGmjnA pVQ+x9rBHbhauqPlITsreXesGH9u5pvmq0NzKfpbuLBx0tdRI9o2oNir3vUp0glVnAMQicix78EWi 5zL4UJpvoLT9xKZ34ajrC/9R0a1tdL6HRBJfQWXp7WhMHAgknOvyiB4Q87U4ugiKLQFYvqPwEYYFJ RwMCyJ+8BrtgGWlCu4VJBUhoKtkUoGCvrPVNiKSl8hR3Gd5F2jjJaCGkFda+pGg7+hkIikWkEn8Da Ex7uC/qGucqM2g==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ow02k-0005PZ-Gr; Fri, 18 Nov 2022 07:00:26 -0500 In-Reply-To: (xenodasein@tutanota.de) 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:300103 Archived-At: > Date: Fri, 18 Nov 2022 12:31:59 +0100 (CET) > From: xenodasein@tutanota.de > Cc: Po Lu , emacs-devel@gnu.org, rms@gnu.org, > pappasbrent@knights.ucf.edu > > Nov 18, 2022, 08:34 by eliz@gnu.org: > > >> #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) > >> > > > > The purpose of macros such as the above is to explain the meaning of > > the code in human-readable terms. Replacing this by functions makes > > no more sense than replacing "c = a + b;" with a function. > > > > Right?  Who needs a proper API when you can have paranoid parentheses > macros with bit hackery! Bitwise operations are first-class citizens in C code, so your sarcasm is misguided.