"TIME SMART STUDY" में आप सभी का स्वागत है
आज हम बात करेंगे C++ Program के inline function की―
Inline Function—
Inline function में function call replace हो जाता है function code से।
C++ provides an inline functions to reduce the function call overhead. Inline function is a function that is expanded in line when it is call. When the inline function is called whole code of the inline functions gets inserted or substituted at the point of inline function call.
Advantage—
Execution fast हो जाता है।
Disadvantage―
Program की length increase (ज्यादा) हो जाती है।
Inline function limitation—
- अगर किसी function में हम looping का use करते हैं तो उसे हम Inline function नही बना सकते ।
- इसमे static variable का use हम नहीं कर सकते।
- Function का recursion नहीं होना चाहिए।
- Switch or goto हम inline function में हम use नही कर सकते।
HOW DOES RECURSIVE FUNCTION WORKS—
INLINE FUNCTION DISADVANTAGES:-
अगर हम दो variable बना रहें हैं तो हम compile करते है तो function code को attach करना पड़ता हैं।
- When inline function body is substituted at the point of function call, total number of variables used by the function also get inserted. So the no of register going to be used for the variable will also get increased.
- If you use too many inline function then the size of binary executable file will be large, because of the dublication of same code.
Comments
Post a Comment
Please Subscribe and Comments my blog site.