473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

verify inline function

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

May 29 '06 #1
4 2185
mashrur....@gmail.com wrote:
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

May 29 '06 #2
* ma*********@gmail.com:

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.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
May 29 '06 #3
I think I found it, its optimizer option -O3

May 29 '06 #4
Hello,

ma*********@gmail.com wrote:
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
May 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: A | last post by:
Hi, I'm having problems completing a project in C++. I have been using inline functions in some of my header files. I have only done so for simple functions that only have 1 statement (eg....
14
by: Chris Mantoulidis | last post by:
I am not clear with the use of the keyword inline... I believe you add it do a function when you implement the function inside the header file where the class is stored... But is that all? What...
47
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
20
by: Grumble | last post by:
Hello everyone, As far as I understand, the 'inline' keyword is a hint for the compiler to consider the function in question as a candidate for inlining, yes? What happens when a function with...
5
by: Tony Johansson | last post by:
Hello experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that sound strange. Here is the whole section: It says" Because...
6
by: RainBow | last post by:
Greetings!! I introduced the so-called "thin-template" pattern for controlling the code bloat caused due to template usage. However, one of the functions in the template happens to be virtual...
9
by: Bilgehan.Balban | last post by:
Hi, If I define an inline function in one .c file, and use it from another, after compiling and linking the two, it seems the function is not inlined but rather called as a regular function. I...
7
by: Wu Shaohua | last post by:
Hi Guys, 1. As we know usually we should not define a constructor as inline. I also learned if we define a member function inside the class this member function will be automatically be...
12
by: sam_cit | last post by:
Hi Everyone, I have few questions on inline functions, when i declare a function as inline, is it for sure that the compiler would replace the function call with the actual body of the function?...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.