SlideShare a Scribd company logo
1 of 13
PRESENTATION TOPIC
INSLINE FUNCTION
REPRRESENTATOR :
IMRAN KHAN
FAHAD NUOMAN
Contents :
 INLINE FUNCTION
 Syntax
 Example
 USES
 ADVANTAGES
 DISADVANTAGES
What is inline function ?
 INLINE FUNCTION :
 . If a function is inline, the compiler places a
copy of the code of that function at each
point where the function is called at
compile time
Syntax of inline function
 Inline return _type fun_name (arguments)
 #include<iostream>
 using namespace std;
 inline int max(int x, int y)
 {
 return (x>y) ? x : y;
 }
 int main()
 {
 int a,b;
 cout<<"enter value for a"<<endl;
 cin>>a;
 cout<<"enter value for b"<<endl;
 cin>>b;
 cout<<"greater value is"<<max( a,b );

 return 0;
Working procedure of inline functions
Uses Of INLINE FUNCTION :
To reduce and save the memory space .
The inline function is just a code replacement
instead of the function call .
inline is a hint or request to compiler and its
used to avoid function call overheads.
Advantages:-
1. It speeds up your program by avoiding
function calling overhead.
2. It save overhead of variables push/pop on
the stack, when function calling happens.
3. It save overhead of return call from a
function.
4. It increases locality of reference by
utilizing instruction cache.
1. By marking it as inline, you can put a function
definition in a header file (i.e. it can be included
in multiple compilation unit, without the linker
complaining)
Disadvantages:-
1. It increases the executable size due to code
expansion.
2. C++ inlining is resolved at compile time. Which
means if you change the code of the inlined
function, you would need to recompile all the
code using it to make sure it will be updated.
3. When used in a header, it makes your header file
larger with information which users don’t care.
4. As mentioned above it increases the executable
size, which may cause thrashing in memory.
More number of page fault bringing down your
program performance.
 As mentioned above it increases the
executable size, which may cause thrashing
in memory. More number of page fault
bringing down your program performance.
inline function

More Related Content

What's hot

What's hot (20)

Pointer to function 1
Pointer to function 1Pointer to function 1
Pointer to function 1
 
Function
FunctionFunction
Function
 
Inline Functions and Default arguments
Inline Functions and Default argumentsInline Functions and Default arguments
Inline Functions and Default arguments
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
Function arguments In Python
Function arguments In PythonFunction arguments In Python
Function arguments In Python
 
Recursive functions in C
Recursive functions in CRecursive functions in C
Recursive functions in C
 
06. operator overloading
06. operator overloading06. operator overloading
06. operator overloading
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
Pointers and call by value, reference, address in C
Pointers and call by value, reference, address in CPointers and call by value, reference, address in C
Pointers and call by value, reference, address in C
 
Programming in ansi C by Balaguruswami
Programming in ansi C by BalaguruswamiProgramming in ansi C by Balaguruswami
Programming in ansi C by Balaguruswami
 
stack & queue
stack & queuestack & queue
stack & queue
 
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in C
 
C pointer
C pointerC pointer
C pointer
 
16717 functions in C++
16717 functions in C++16717 functions in C++
16717 functions in C++
 
Pointers
PointersPointers
Pointers
 
array of object pointer in c++
array of object pointer in c++array of object pointer in c++
array of object pointer in c++
 
String functions in C
String functions in CString functions in C
String functions in C
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
 

Viewers also liked

Matrix transapose in c++
Matrix transapose in c++Matrix transapose in c++
Matrix transapose in c++imran khan
 
Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)indiangarg
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerJeba Moses
 
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014Supriya Radhakrishna
 
M.Tech : Advanced DBMS Assignment I
M.Tech : Advanced DBMS Assignment IM.Tech : Advanced DBMS Assignment I
M.Tech : Advanced DBMS Assignment IVijayananda Mohire
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++Jenish Patel
 
Software Engineering tools
Software Engineering tools Software Engineering tools
Software Engineering tools imran khan
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++Learn By Watch
 
05211201 Advanced Data Structures And Algorithms
05211201 Advanced Data Structures  And  Algorithms05211201 Advanced Data Structures  And  Algorithms
05211201 Advanced Data Structures And Algorithmsguestac67362
 
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSM.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSSupriya Radhakrishna
 
Datastructure notes
Datastructure notesDatastructure notes
Datastructure notesSrikanth
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS ConceptBoopathi K
 

Viewers also liked (20)

Matrix transapose in c++
Matrix transapose in c++Matrix transapose in c++
Matrix transapose in c++
 
Functions
FunctionsFunctions
Functions
 
EEE 3rd year oops cat 3 ans
EEE 3rd year  oops cat 3  ansEEE 3rd year  oops cat 3  ans
EEE 3rd year oops cat 3 ans
 
Trees
TreesTrees
Trees
 
Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
 
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
 
Viva questions
Viva questions Viva questions
Viva questions
 
M.Tech : Advanced DBMS Assignment I
M.Tech : Advanced DBMS Assignment IM.Tech : Advanced DBMS Assignment I
M.Tech : Advanced DBMS Assignment I
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++
 
Software Engineering tools
Software Engineering tools Software Engineering tools
Software Engineering tools
 
Inline function in C++
Inline function in C++Inline function in C++
Inline function in C++
 
6th Semester CS / IS (2013-June) Question Papers
6th Semester CS / IS (2013-June) Question Papers6th Semester CS / IS (2013-June) Question Papers
6th Semester CS / IS (2013-June) Question Papers
 
05211201 Advanced Data Structures And Algorithms
05211201 Advanced Data Structures  And  Algorithms05211201 Advanced Data Structures  And  Algorithms
05211201 Advanced Data Structures And Algorithms
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
OOPS IN C++
OOPS IN C++OOPS IN C++
OOPS IN C++
 
Dacj 1-1 b
Dacj 1-1 bDacj 1-1 b
Dacj 1-1 b
 
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSM.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
 
Datastructure notes
Datastructure notesDatastructure notes
Datastructure notes
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 

Similar to inline function

Function Overloading,Inline Function and Recursion in C++ By Faisal Shahzad
Function Overloading,Inline Function and Recursion in C++ By Faisal ShahzadFunction Overloading,Inline Function and Recursion in C++ By Faisal Shahzad
Function Overloading,Inline Function and Recursion in C++ By Faisal ShahzadFaisal Shehzad
 
OOP-Module-1-Section-4-LectureNo1-5.pptx
OOP-Module-1-Section-4-LectureNo1-5.pptxOOP-Module-1-Section-4-LectureNo1-5.pptx
OOP-Module-1-Section-4-LectureNo1-5.pptxsarthakgithub
 
Functions in c++, presentation, short and sweet presentation, and details of ...
Functions in c++, presentation, short and sweet presentation, and details of ...Functions in c++, presentation, short and sweet presentation, and details of ...
Functions in c++, presentation, short and sweet presentation, and details of ...Sar
 
Modular Programming in C
Modular Programming in CModular Programming in C
Modular Programming in Cbhawna kol
 
Basic information of function in cpu
Basic information of function in cpuBasic information of function in cpu
Basic information of function in cpuDhaval Jalalpara
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1YOGESH SINGH
 
Compiler optimizations based on call-graph flattening
Compiler optimizations based on call-graph flatteningCompiler optimizations based on call-graph flattening
Compiler optimizations based on call-graph flatteningCAFxX
 
Functions assignment
Functions assignmentFunctions assignment
Functions assignmentAhmad Kamal
 
Programming in c++ ppt
Programming in c++ pptProgramming in c++ ppt
Programming in c++ pptsujathavvv
 
Programming in c++ ppt
Programming in c++ pptProgramming in c++ ppt
Programming in c++ pptMalarMohana
 
Functions in c
Functions in cFunctions in c
Functions in creshmy12
 

Similar to inline function (20)

Inline functions
Inline functionsInline functions
Inline functions
 
Function Overloading,Inline Function and Recursion in C++ By Faisal Shahzad
Function Overloading,Inline Function and Recursion in C++ By Faisal ShahzadFunction Overloading,Inline Function and Recursion in C++ By Faisal Shahzad
Function Overloading,Inline Function and Recursion in C++ By Faisal Shahzad
 
inline function
inline functioninline function
inline function
 
OOP-Module-1-Section-4-LectureNo1-5.pptx
OOP-Module-1-Section-4-LectureNo1-5.pptxOOP-Module-1-Section-4-LectureNo1-5.pptx
OOP-Module-1-Section-4-LectureNo1-5.pptx
 
Functions in c++, presentation, short and sweet presentation, and details of ...
Functions in c++, presentation, short and sweet presentation, and details of ...Functions in c++, presentation, short and sweet presentation, and details of ...
Functions in c++, presentation, short and sweet presentation, and details of ...
 
Modular Programming in C
Modular Programming in CModular Programming in C
Modular Programming in C
 
Basic information of function in cpu
Basic information of function in cpuBasic information of function in cpu
Basic information of function in cpu
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
08 -functions
08  -functions08  -functions
08 -functions
 
Compiler optimizations based on call-graph flattening
Compiler optimizations based on call-graph flatteningCompiler optimizations based on call-graph flattening
Compiler optimizations based on call-graph flattening
 
Functions assignment
Functions assignmentFunctions assignment
Functions assignment
 
Chap 5 c++
Chap 5 c++Chap 5 c++
Chap 5 c++
 
Chap 5 c++
Chap 5 c++Chap 5 c++
Chap 5 c++
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
C++
C++C++
C++
 
Programming in c++ ppt
Programming in c++ pptProgramming in c++ ppt
Programming in c++ ppt
 
Programming in c++ ppt
Programming in c++ pptProgramming in c++ ppt
Programming in c++ ppt
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Function overloading ppt
Function overloading pptFunction overloading ppt
Function overloading ppt
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 

More from imran khan

Exception handling in c++
Exception handling in c++Exception handling in c++
Exception handling in c++imran khan
 
ohm's law and circuits
ohm's law and  circuitsohm's law and  circuits
ohm's law and circuitsimran khan
 
Ideology of pakistan
Ideology of pakistanIdeology of pakistan
Ideology of pakistanimran khan
 
limits and continuity
limits and continuity limits and continuity
limits and continuity imran khan
 

More from imran khan (8)

Exception handling in c++
Exception handling in c++Exception handling in c++
Exception handling in c++
 
Business plan
Business planBusiness plan
Business plan
 
resistors
resistorsresistors
resistors
 
ohm's law and circuits
ohm's law and  circuitsohm's law and  circuits
ohm's law and circuits
 
Ideology of pakistan
Ideology of pakistanIdeology of pakistan
Ideology of pakistan
 
Intelligence
IntelligenceIntelligence
Intelligence
 
limits and continuity
limits and continuity limits and continuity
limits and continuity
 
Data mining
Data miningData mining
Data mining
 

Recently uploaded

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 

Recently uploaded (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

inline function

  • 1.
  • 3. Contents :  INLINE FUNCTION  Syntax  Example  USES  ADVANTAGES  DISADVANTAGES
  • 4. What is inline function ?  INLINE FUNCTION :  . If a function is inline, the compiler places a copy of the code of that function at each point where the function is called at compile time
  • 5. Syntax of inline function  Inline return _type fun_name (arguments)
  • 6.  #include<iostream>  using namespace std;  inline int max(int x, int y)  {  return (x>y) ? x : y;  }  int main()  {  int a,b;  cout<<"enter value for a"<<endl;  cin>>a;  cout<<"enter value for b"<<endl;  cin>>b;  cout<<"greater value is"<<max( a,b );   return 0;
  • 7. Working procedure of inline functions
  • 8. Uses Of INLINE FUNCTION : To reduce and save the memory space . The inline function is just a code replacement instead of the function call . inline is a hint or request to compiler and its used to avoid function call overheads.
  • 9. Advantages:- 1. It speeds up your program by avoiding function calling overhead. 2. It save overhead of variables push/pop on the stack, when function calling happens. 3. It save overhead of return call from a function. 4. It increases locality of reference by utilizing instruction cache.
  • 10. 1. By marking it as inline, you can put a function definition in a header file (i.e. it can be included in multiple compilation unit, without the linker complaining)
  • 11. Disadvantages:- 1. It increases the executable size due to code expansion. 2. C++ inlining is resolved at compile time. Which means if you change the code of the inlined function, you would need to recompile all the code using it to make sure it will be updated. 3. When used in a header, it makes your header file larger with information which users don’t care. 4. As mentioned above it increases the executable size, which may cause thrashing in memory. More number of page fault bringing down your program performance.
  • 12.  As mentioned above it increases the executable size, which may cause thrashing in memory. More number of page fault bringing down your program performance.