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 14:00:30 +0200

> Date: Fri, 18 Nov 2022 12:31:59 +0100 (CET)
> From: xenodasein@tutanota.de
> Cc: Po Lu <luangruo@yahoo.com>, 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.



reply via email to

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