[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Emacs' C: static inline considered useless nowadays?
From: |
Matt Armstrong |
Subject: |
Emacs' C: static inline considered useless nowadays? |
Date: |
Sun, 16 Oct 2022 15:08:51 -0700 |
For Emacs, I would think:
a) In header files, use Emacs' INLINE and NO_INLINE macros.
b) In .c files, use static, EXTERN_INLINE, but never 'inline' since it
does nothing.
I'm seeking confirmation (or refutation) of (a) and (b). I'm not asking
generally, but for Emacs' C code.
Specifically, ignoring the uselesness of the function itself, assuming
the code is in a .c file, is the use of the "inline" keyword redundant
with static, below?
static inline int
add_two_int (int a, int b)
{
return a + b
}
I've spent the last few decades coding with an undersanding that
"inline" is about linkage and allows one to place code in header files
so that it *may* be inlined, but that compilers long ago stopped using
it as a meaningful inlining hint. But this is mostly colored by how gcc
and clang behave with C++, and not much else.
--
matt (sent from an Emacs running the feature/noverlay branch)
- Emacs' C: static inline considered useless nowadays?,
Matt Armstrong <=
- Re: Emacs' C: static inline considered useless nowadays?, Stefan Monnier, 2022/10/16
- Re: Emacs' C: static inline considered useless nowadays?, Eli Zaretskii, 2022/10/17
- Re: Emacs' C: static inline considered useless nowadays?, Matt Armstrong, 2022/10/17
- Re: Emacs' C: static inline considered useless nowadays?, Eli Zaretskii, 2022/10/17
- Re: Emacs' C: static inline considered useless nowadays?, Matt Armstrong, 2022/10/17
- Re: Emacs' C: static inline considered useless nowadays?, Eli Zaretskii, 2022/10/17
- Re: Emacs' C: static inline considered useless nowadays?, Stefan Monnier, 2022/10/18
- Re: Emacs' C: static inline considered useless nowadays?, Eli Zaretskii, 2022/10/18