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 10:34:55 +0200 Message-ID: <83wn7sbqz4.fsf@gnu.org> References: <83r0y4idy8.fsf@gnu.org> <87leo8eq0y.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8960"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, rms@gnu.org, xenodasein@tutanota.de, 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 09:35:10 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 1ovwq5-00023S-OJ for ged-emacs-devel@m.gmane-mx.org; Fri, 18 Nov 2022 09:35:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovwpt-0003Pd-3V; Fri, 18 Nov 2022 03:34:57 -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 1ovwpr-0003PB-Gi for emacs-devel@gnu.org; Fri, 18 Nov 2022 03:34:55 -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 1ovwpp-0007Z3-VZ; Fri, 18 Nov 2022 03:34:53 -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=upfM8QlmLX/quSKa0zJGtfHmjL44Ccb3ht11WKNQmJQ=; b=pqevI1rKDcHk apDrMWllCueyKOFSyuVqzOcUPRJNFfUkG5Q4TJugp45Q5emlEhZ8GqMqdopvLrLBJ2ybEHsO24BLn D2CzKvfr3TvKPYs8X/K7XlqV6Z6UdrzSyKsBOix6Hz3TgFaOfS0wdAYts70BsUrKCCye7z/wkIeNz 6pVsl86IZlQI2rrFSykIC4g32tzqwm2goiWzyFAm4MtM/zKTJ+mcJhi1kUCRTOcc5xfRFO2GLQxhP YXdhylC9gZ85XxV4ozPVsEUS1DyX1KjIhh261+pLnn8iCwNMScGmWZfgnToAtChmoRQc5OXOOYAZE hA+BbAWHoAFqO810ChQBzg==; 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 1ovwpp-0003I4-32; Fri, 18 Nov 2022 03:34:53 -0500 In-Reply-To: <87leo8eq0y.fsf@yahoo.com> (message from Po Lu on Fri, 18 Nov 2022 14:27:09 +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:300099 Archived-At: > From: Po Lu > Cc: Richard Stallman , xenodasein@tutanota.de, Eli Zaretskii > , pappasbrent@knights.ucf.edu > Date: Fri, 18 Nov 2022 14:27:09 +0800 > > 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) 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.