[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.
- Thoughts on replacing macros with static inline functions, Brent Pappas, 2022/11/14
- Re: Thoughts on replacing macros with static inline functions, tomas, 2022/11/18
- Re: Thoughts on replacing macros with static inline functions, xenodasein, 2022/11/18
- Re: Thoughts on replacing macros with static inline functions, Stefan Monnier, 2022/11/18
- Re: Thoughts on replacing macros with static inline functions, Dr. Arne Babenhauserheide, 2022/11/18
Re: Thoughts on replacing macros with static inline functions, Po Lu, 2022/11/15
Re: Thoughts on replacing macros with static inline functions, Stefan Monnier, 2022/11/15