[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Thoughts on replacing macros with static inline functions
From: |
xenodasein |
Subject: |
Re: Thoughts on replacing macros with static inline functions |
Date: |
Fri, 18 Nov 2022 07:32:39 +0100 (CET) |
Nov 18, 2022, 06:27 by luangruo@yahoo.com:
> xenodasein--- via "Emacs development discussions." <emacs-devel@gnu.org>
> writes:
>
>> Why do you not consider __attribute__((always_inline)) an improvement
>> over macros where applicable?
>>
>
> And exactly where is __attribute__((always_inline)) present? Only on
> GCC, right? What about Sun C, and other C99 compilers?
>
> 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)
>
> ?
>
Lookup why functions are considered an improvement over macros.
As for compiler support, I bet the time spent debugging where there is
support is going to dwarf where isn't, so trade-off is clear.
- Thoughts on replacing macros with static inline functions, Brent Pappas, 2022/11/14
- Re: Thoughts on replacing macros with static inline functions, Eli Zaretskii, 2022/11/15
- Re: Thoughts on replacing macros with static inline functions, Richard Stallman, 2022/11/18
- Re: Thoughts on replacing macros with static inline functions, Eli Zaretskii, 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, Po Lu, 2022/11/18
- Re: Thoughts on replacing macros with static inline functions, Eli Zaretskii, 2022/11/18
- 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