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: 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.





reply via email to

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