emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thoughts on replacing macros with static inline functions


From: Eli Zaretskii
Subject: Re: Thoughts on replacing macros with static inline functions
Date: Fri, 18 Nov 2022 10:34:55 +0200

> From: Po Lu <luangruo@yahoo.com>
> Cc: Richard Stallman <rms@gnu.org>,  xenodasein@tutanota.de,  Eli Zaretskii
>  <eliz@gnu.org>,  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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]