Re: On inlining of functions across 2 or more object files

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

 



Hi,

To John, thanks for the quick response.

[snipped]

> For the simple case you described, I'm sure the code defined in file2.cpp is
> NOT inlined into code defined in file1.cpp

That's bad. I guess, I will have to copy paste the file2.cpp into file1.cpp.

>
>> Under any circumstances, it would be unacceptable for me to have an
>> inline function silently expanded to a "true" function.
>>
>
> I'm not sure what you mean.  (see my guess below).

I meant unacceptable performance wise. I spent a lot of time chasing
it and I sure as hell don't want it to be lost, worst of all,
silently.

> I'm pretty sure the "inline" keyword is just a suggestion to the compiler,
> not a command.  It will silently compile the function non inline whenever it
> feels like it.

I think so too. If that is the case, then the docs should say so as
well. ATM, they say specifically, inline functions are as fast as
macro. At the very least, it should tell us if some function was not
inlined as part of compilation report.

>
> There are some stronger forms of syntax to tell the compiler whether or not
> to inline a function.  I'm constantly frustrated by the fact that every one
> of those is just a suggestion to the Intel compiler and none are even a
> strong suggestion.  No syntax you can put on an individual function
> declaration or definition will strongly influence its decision to inline it
> or not.  It just does what it thinks is best.  Regarding inlining, that is
> rarely good.  I don't think gcc is quite that lame about ignoring what the
> programmer specifies.  But I don't know the details.  I don't know if there
> is a way to get the behavior I think you mean:
>
> A) Inline this function if there is any way at all to do so.
> B) Fail to finish the compile/link if there is no way to inline this
> function.

In case you can't/don't inline it, please just tell me so. Just like
it reports if a loop has been vectorized. That would be enough for
now.

-- 
Rohit Garg

http://rpg-314.blogspot.com/

Senior Undergraduate
Department of Physics
Indian Institute of Technology
Bombay

[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