Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What are the advantages and disadvantages of using inline
and const?

Answers were Sorted based on User's Feedback



What are the advantages and disadvantages of using inline and const?..

Answer / nidhi singh

advantages of inline-no function calls need to be
generated.no stack required.
disadvantage -inline functions require more space..
the whole definition is copied.
by using const we insure the value of variable is not goin
to change..

Is This Answer Correct ?    42 Yes 13 No

What are the advantages and disadvantages of using inline and const?..

Answer / vivek mahto

Well for the inline..

Advantages-
inline is a compiler directive so it will make compiler to copy the whole function where it is required , So there is no stack frame required in the stack section for storing the address of the function .

Disadvantages-
inline should only be used for the long functions as it will require more space as well as more calculation time.

For the const...

Advantages--
If you want any variable to keep constant through out the program then you can use const keyword. It is stored in the read only of the initalized data segment , even the pointer storing it's location cannot change the value of it, pointer can just change the address to point at some other location.

Disadvantages--
As the const is not flexible so mostly people use #define which is more flexible than const

Is This Answer Correct ?    5 Yes 1 No

Post New Answer

More C++ General Interview Questions

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

0 Answers  


How many namespaces are there in c++?

0 Answers  


What does it mean to declare a destructor as static?

0 Answers  


What are references in c++? What is a local reference?

0 Answers  


Which of the following is evaluated first: a) && b) || c) !

0 Answers  


What are the five basic elements of a c++ program?

0 Answers  


Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?

0 Answers  


Why is c++ still used?

0 Answers  


How many different levels of pointers are there?

0 Answers   Genpact,


What is c++ runtime?

0 Answers  


What does '\r' and '\b' mean? Please explain with example.

7 Answers  


What are the advantages of using pointers in a program?

0 Answers  


Categories