verify inline function

M

mashrur.mia

Hello All,

Since "inline" keyboard is basically an advice to the compiler to
inline a function, is there a way to know whether the complier took the
advice?

I guess one way to verify is to check the file size of the executable
or the object file. Is there any other way? Perhaps checking the
assembler code the compiler generates? I am using g++ so I can
generated .s file with -S option. Although, I am not a assember
programmer, but even when simple inline function is used, I see the
assember using "call" instruction for my simple inline function.

Any help will be appreciated.

Mashrur
 
A

Achintya

Hello All,

Since "inline" keyboard is basically an advice to the compiler to
inline a function, is there a way to know whether the complier took the
advice?

I guess one way to verify is to check the file size of the executable
or the object file. Is there any other way? Perhaps checking the
assembler code the compiler generates? I am using g++ so I can
generated .s file with -S option. Although, I am not a assember
programmer, but even when simple inline function is used, I see the
assember using "call" instruction for my simple inline function.

Any help will be appreciated.

Mashrur

You need to look into different g++ compier options. I'm sure which one
to use specifically.

-vs_p
 
A

Alf P. Steinbach

* (e-mail address removed):
Since "inline" keyboard is basically an advice to the compiler to
inline a function,

Sorry, no, it's not.

It's tells the compiler that you're taking responsibility for having all
definitions of that function identical, so that the linker can choose
one, instead of complaining about multiple definitions.

Additionally it serves as hint about inlining, which however your
compiler is likely to ignore, given that the primary usage is in direct
conflict with the hinting.

is there a way to know whether the complier took the advice?

For any particular call of the function you can check the machine code.

However, if you're concerned about execution time or memory usage you
should measure: nothing else is good enough.

One way to measure is to use a profiler tool.
 
B

Bernd Strieder

Hello,

Since "inline" keyboard is basically an advice to the compiler to
inline a function, is there a way to know whether the complier took
the advice?

I guess one way to verify is to check the file size of the executable
or the object file. Is there any other way? Perhaps checking the
assembler code the compiler generates? I am using g++ so I can
generated .s file with -S option. Although, I am not a assember
programmer, but even when simple inline function is used, I see the
assember using "call" instruction for my simple inline function.

Any help will be appreciated.

Post a minimal example of code and the commands to reproduce the
problem. Since it has to do with the quality of a single compiler, i.e.
it is rather off-topic here, better post your question to a group
dedicated to that, e.g. gnu.g++.help. Perhaps read about doing
bug-reports for gcc first, and include information in your post
accordingly.

Bernd Strieder
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top