all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs' C: static inline considered useless nowadays?
@ 2022-10-16 22:08 Matt Armstrong
  2022-10-17  0:43 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Matt Armstrong @ 2022-10-16 22:08 UTC (permalink / raw)
  To: emacs-devel

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)



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-10-18 19:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-16 22:08 Emacs' C: static inline considered useless nowadays? Matt Armstrong
2022-10-17  0:43 ` Stefan Monnier
2022-10-17  3:13   ` Matt Armstrong
2022-10-17  3:33     ` Óscar Fuentes
2022-10-17  6:10 ` Eli Zaretskii
2022-10-17 19:08   ` Matt Armstrong
2022-10-17 19:12     ` Eli Zaretskii
2022-10-17 20:33       ` Matt Armstrong
2022-10-18  2:30         ` Eli Zaretskii
2022-10-18 13:32           ` Stefan Monnier
2022-10-18 15:09             ` Eli Zaretskii
2022-10-18 17:01               ` tomas
2022-10-18 19:22               ` Stefan Monnier
2022-10-18 19:31                 ` Eli Zaretskii
2022-10-18 11:58 ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.