[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs' C: static inline considered useless nowadays?

From: Matt Armstrong
Subject: Re: Emacs' C: static inline considered useless nowadays?
Date: Mon, 17 Oct 2022 13:33:18 -0700

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Matt Armstrong <matt@rfc20.org>
>> Cc: emacs-devel@gnu.org
>> Date: Mon, 17 Oct 2022 12:08:38 -0700
>> > See conf_post.h, around line 395: it explains the issue and the
>> > expected usage of these in our sources.
>> conf_post.h didn't answer my question since it seems to pertain to code
>> in header files.
> Why would you need 'inline' anywhere else?

That is the question I started the thread with, in different words.  If
you grep our sources 'static inline' appears in .c files, and I wondered

Stefan gave an answer in the form of a question (he was concerned about
what gcc did at optimization level -Og).  I investigated and found that
gcc (and clang) will inline a static function at -Og level only if the
function uses the inline keyword.  So a "static inline" function is
useful in the case where you want some key static functions inlined, but
everything else still relatively unoptimized.

reply via email to

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