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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to find the reverse Fibonacci series starting from N.

1266


Implement stack operations with pointers with appropriate exception checks.

975


Write a code/algo to find the frequency of each element in an array?

1112


Which is most difficult programming language?

1098


What are all predefined data types in c++?

1123


Why do we need templates?

988


What is #include c++?

1129


Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.

1113


Evaluate the following expression as C++ would do :8 * 9 + 2 * 5 a) 82 b) 79 c) 370 d) list

1000


What are its advantages and disadvantages of multiple inheritances (virtual inheritance)?

1193


What is c++ virtual inheritance?

1131


What do you mean by inheritance in c++? Explain its types.

1135


Why is null pointer used?

1169


What does flush do?

987


What is linked list in c++?

1131