[Top][All Lists]

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

Re: _GL_INLINE issue

From: Bruno Haible
Subject: Re: _GL_INLINE issue
Date: Fri, 13 Apr 2018 16:03:45 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-119-generic; KDE/5.18.0; x86_64; ; )

Hi Tim,

> We use 'static _GL_INLINE' for some static functions we want to get
> inlined.

This is a wrong use of '_GL_INLINE'.

There are 3 uses of the keyword 'inline' in C:
1) 'static inline'.
2) 'inline' and 'extern inline'.

Portable use of 1) is simple:
  - use 'static inline' in the code.

Portable use of 2) is more involved: This is what
is about.

When you write 'static _GL_INLINE', you are mixing up the cases 1) and 2).

> "C code ordinarily should not use inline. Typically it is better to let
> the compiler figure out whether to inline, as compilers are pretty good
> about optimization nowadays. In this sense, inline is like register,
> another keyword that is typically no longer needed."

This advice applies to modern compilers.

By the way, Paul, what is the problem with telling the compiler what to
'static inline'? In other words, what was the motivation of changing
'static inline' to 'static' - other than "it's not needed" - in the
13 patches presented on November 09, 2012 in
https://lists.gnu.org/archive/html/bug-gnulib/2012-11/ and committed on
2012-11-29 ?


reply via email to

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