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

Which is better turbo c++ or dev c++?

1015


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

963


What is helper in c++?

1049


what is Member Functions in Classes?

1137


How would you use qsort() function to sort an array of structures?

1079


Tell me an example where stacks are useful?

1001


Why was c++ made?

1051


What is the main use of c++?

1081


Is the declaration of a class its interface or its implementation?

1137


What is ostream in c++?

969


Define a conversion constructor?

1042


Why c++ is created?

962


Is c++ proprietary?

1021


If dog is a friend of boy and boy is a friend of house, is dog a friend of house?

964


Can static member variables be private?

1132