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

Is there any function that can skip certain number of characters present in the input stream?

1012


What do the keywords volatile and mean mutable?

1004


What are the sizes and ranges of the basic c++ data types?

991


How much maximum can you allocate in a single call to malloc()?

1057


What is virtual destructor ans explain its use?

1071


What is the difference between equal to (==) and assignment operator (=)?

1017


Explain what are accessor methods?

1066


What is the protected keyword used for?

1060


Which software is used for c++ programming?

1037


What are the benefits of pointers?

984


why is c++ called oops? Explain

985


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

994


What is pointer to array in c++?

1078


What is a literal in c++?

1017


Why do we use classes in programming?

985