difference between macro and function?

Answer Posted / utpal kumar kashyap

Hi to Everyone,
See, inline function is a function whose code get inserted instead of jump to the function where it was called.
We can make any function as inline but there are few conditions in which compiler will not treat it as inline function....
If
1. Function contains any static variable.
2. It recursive.
3. Function code is large.

However, if function body is large and in this case if we try to make it as inline, then compiler wont give an error, but compiler would treat it as normal function. So idea is this, function code should be small for making it inline.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the various compound assignment operators in c++?

541


How do you find out if a linked-list has an end? (I.e. The list is not a cycle)

596


Show the declaration for a pointer to function returning long and taking an integer parameter.

568


What is the difference between #import and #include in c++?

590


What is a lambda function c++?

547






Is c++ pass by reference or value?

565


Will a catch statement catch a derived exception if it is looking for the base class?

554


What is a pointer how and when is it used?

567


Can I learn c++ without c?

597


Write about the role of c++ in the tradeoff of safety vs. Usability?

589


Why is c++ still best?

547


Is there a sort function in c++?

543


Can I have a reference as a data member of a class? If yes, then how do I initialise it?

698


Can a program run without main function?

611


What are virtual constructors/destructors?

571