Separate meaning for "inline" and "force inline"

Guillaume Piolat firstname.name at spam.com
Wed Nov 20 11:01:18 UTC 2024


Currently if I understand correctly there are two meanings for 
`pragma(inline)`.


1. This means "the body of f is public, it is replicated in .di 
headers":

     pragma(inline, true)
     void f()
     {
         // something
     }



2. This means "the function will be inlined":

     void f()
     {
         pragma(inline, true);
         // something
     }


Is there any reason why we have those 2 differing semantics using 
the same syntax? This is similar to C++ inline (which is about 
visibility) and __force_inline, and in the end it doesn't seem 
like publishing the bodies has anything to do with te decision to 
inline.

Currently, LTO can be used to inline things anyway, even things 
that weren't "external pragma(inline)", just like in C++.




More information about the dip.ideas mailing list