Re: C: inline without forcing?

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

 



On Wed, Jun 02, 2021 at 10:42:06PM -0400, Danielle Church wrote:
> On Wed, Jun 2, 2021, 18:30 Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx>
> wrote:
> 
> > On Wed, Jun 02, 2021 at 12:22:58PM -0400, Danielle Church wrote:
> > > On Wed, Jun 2, 2021 at 11:54 AM Segher Boessenkool
> > > <segher@xxxxxxxxxxxxxxxxxxx> wrote:
> > > > > Is there no way to get the code-emit behavior (inline the
> > > > > function or emit a TU-external reference, don't emit standalone
> > > > > definition) without the optimizer changes (more likely to inline the
> > > > > function, even if it's a bad idea)?
> > > >
> > > > extern attribute((gnu_inline))
> > >
> > > Does ``extern inline attribute((gnu_inline))'' behave appreciably
> > > differently than C99's bare ``inline''? They seem to have the same
> > > effect from the documentation, though with reversed semantics for the
> > > presence vs absence of the extern keyword.
> >
> > Neither GNU inline nor standard C inline is inclusive of the other.  A
> > gnu_inline extern inline is never emitted as a standalone function.
> >
> 
> Can you explain to me how that's different from C99 inline? I'm afraid I
> don't understand, since a C99 declaration like
> 
> inline void foo() {
>  ...
> }
> 
> won't emit a standalone function either, no?

It does if you first declared foo() without inline:

int f(void);
inline int f(void) { return 42; }


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux