473,494 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

inline functions

Let's say I have a function

func()
{

............
func();
..........
}

I.e it is a recursive function. What happens if I declare it inline

Feb 7 '06 #1
3 6196
On 2006-02-07, Aloo <an************@rediffmail.com> wrote:
Let's say I have a function

func()
{

...........
func();
.........
}

I.e it is a recursive function. What happens if I declare it inline


It won't be inlined, or it will only be inlined a certain number of
times.

There is no _requirement_ that the compiler insert inline code at any
given place the function is called.
Feb 7 '06 #2
Aloo wrote:
Let's say I have a function

func()
{

............
func();
..........
}

I.e it is a recursive function. What happens if I declare it inline

inline is more of a hint than an instruction, the compiler is at liberty
to ignore 'inline' where it considers inline to be inappropriate. This
would be one of those cases.

--
Ian Collins.
Feb 7 '06 #3
Aloo wrote:
Let's say I have a [recursive] function.
What happens if I declare it inline


inline is merely a hint to the compiler, and it may be ignored.

On a related note, good optimizing compilers can eliminate some
forms of recursion.
Feb 8 '06 #4

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

Similar topics

13
6523
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
2739
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
3795
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
7
2844
by: Srini | last post by:
Hello, Rules for inline functions say that they have to be defined in the same compilation unit as their declarations. For class member functions this means that the inline member functions must...
4
1802
by: Tony Johansson | last post by:
Hello experts! I'm reading a book about C++ and there is something about inline that the book says that is unclear for me. The book says the following "Because inline functions are expanded at...
7
2018
by: Alvin | last post by:
Hello all, I'm curious as to your opinions on explicitly inlining function? I'm talking about functions as members of a class. For example, so class A defines a operator==() and a operator!=():...
43
13205
by: Patrick Laurent | last post by:
Hello I have a program with many many inlined template functions It is essential for the execution speed that every (or almost every) function marked as inlined, becomes really inlined by the...
18
5019
by: Method Man | last post by:
If I don't care about the size of my executable or compile time, is there any reason why I wouldn't want to inline every function in my code to make the program run more efficient?
12
676
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?...
2
2098
by: aaragon | last post by:
Hi everyone, I would like to create a very simple function: // header file inline void point_map() { PointMap pointMap = get(vertex_point_t(), g); } // main.cpp
0
6989
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
7157
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
7195
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
7367
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
5453
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
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1400
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
644
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.