inline functions

A

Aloo

Let's say I have a function

func()
{

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

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

Jordan Abel

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.
 
I

Ian Collins

Aloo said:
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.
 
G

Grumble

Aloo said:
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.
 

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

inline 5
Inline Functions? 3
Array of structs function pointer 10
Inline functions and warning 7
C Programming functions 2
Functions 2
Inline functions and linkage 5
Mailbox form automation 0

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top