UrbanPro

Learn C++ Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is inline function? Why pointers is not used in C++?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

MS SQL SERVER DBA Trainer

Inline function is the optimization technique used by the compilers. One can simply prepend inline keyword to function prototype to make a function inline. Inline function instruct compiler to insert complete body of the function wherever that function got used in code. In computer science, a smart...
read more
Inline function is the optimization technique used by the compilers. One can simply prepend inline keyword to function prototype to make a function inline. Inline function instruct compiler to insert complete body of the function wherever that function got used in code. In computer science, a smart pointer is an abstract data type that simulates a pointer while providing additional features, such as automatic garbage collection or bounds checking. These additional features are intended to reduce bugs caused by the misuse of pointers while retaining efficiency. Smart pointers typically keep track of the objects they point to for the purpose of memory management. read less
Comments

16 Yrs of Experience in Teaching

C++ supports pointers. An inline function is function whose complied code is inline with the rest of the program. Inline function run faster than regular functions.
Comments

Inline function instruct compiler to insert complete body of the function wherever that function got used in code. Compiler takes decision. Pointers are used.
Comments

Computer Engineering / Diploma Tutor

Function which replace in the position where it is called is inline function. Their work is similar to macros. We can use Pointers in C++.
Comments

Full-stack Software Trainer with 8+ years of experience

C++ inline function is powerful concept that is commonly used with classes. 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. In computer science, a smart pointer is an abstract data type that simulates a pointer...
read more
C++ inline function is powerful concept that is commonly used with classes. 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. In computer science, a smart pointer is an abstract data type that simulates a pointer while providing additional features, such as automatic garbage collection or bounds checking. These additional features are intended to reduce bugs caused by the misuse of pointers while retaining efficiency. Smart pointers typically keep track of the objects they point to for the purpose of memory management. The misuse of pointers is a major source of bugs: the constant allocation, deallocation and referencing that must be performed by a program written using pointers introduces the risk that memory leaks will occur. Smart pointers try to prevent memory leaks by making the resource deallocation automatic: when the pointer (or the last in a series of pointers) to an object is destroyed, for example because it goes out of scope, the pointed object is destroyed too. read less
Comments

Tutor

In a program, If you write a small function which you feel is called again and again, then to reduce the function calls declare that function as inline. By doing we, we request the compiler that "if possible replace the function call with the actual function". Pointers are not used in C++ because...
read more
In a program, If you write a small function which you feel is called again and again, then to reduce the function calls declare that function as inline. By doing we, we request the compiler that "if possible replace the function call with the actual function". Pointers are not used in C++ because we have got a good replacement called as "reference" , which does the same work as that of pointers but in a safe way and less cumbersome code. You need not use the (*) deference symbol everywhere. These are explanation in layman terms. For more details you can refer standard books. read less
Comments

M.tech Computer Science

Function calling has its own over head, and the overhead depends on the Operating system and the processor, But in general any function call is a overhead. So if we are calling a function 2 things are important 1. How big the function is ? 2. How frequently we are calling it ? There is a trade...
read more
Function calling has its own over head, and the overhead depends on the Operating system and the processor, But in general any function call is a overhead. So if we are calling a function 2 things are important 1. How big the function is ? 2. How frequently we are calling it ? There is a trade off, Function calling over head and size of the program. if a small function (with 2-3 lines) is called multiple times then each time function is called (Function calling over head + function code + function return over head ) x N by using inline function , the body of the function gets replaced so the calling and return over head are removed. But the size of the program increases by this "copy of code". Then the question is why not inline all ? yes We can, but if the function body is large and it is called multiple times, each time if we replace the code (copy and paste) then size of the program grows unnecessarily. hope this helps. read less
Comments

Mathematics Tutor

Whenever you call an inline function, the compiler will replace the function call with the function body.
Comments

Software Professional Trainer with 26+ years of Experience in Software Design and Development

Inline function will very useful if your line of code is very less, it will improve the peformance as the function call is not there and cpu cycle consumption will be very less. If the line of code inside the function is more, then inline will not improve the performance. Before compilation, the...
read more
Inline function will very useful if your line of code is very less, it will improve the peformance as the function call is not there and cpu cycle consumption will be very less. If the line of code inside the function is more, then inline will not improve the performance. Before compilation, the inline function call will be replaced with actual code inside the inline function. Pointer is used in C++. If you used the pointer efficiently then program will run fast with limited memory read less
Comments

Perl Developer | Perl Trainer

Inline functions are a lot like a placeholder. Once you define an inline function, using the 'inline' keyword, whenever you call that function the compiler will replace the function call with the actual code from the function. In C++ the emphasis would be on garbage collection and preventing memory...
read more
Inline functions are a lot like a placeholder. Once you define an inline function, using the 'inline' keyword, whenever you call that function the compiler will replace the function call with the actual code from the function. In C++ the emphasis would be on garbage collection and preventing memory leaks (just to name two). Pointers are a fundamental part of the language, so not using them is pretty much impossible except in the most trival of programs. read less
Comments

View 26 more Answers

Related Questions

What is the difference between class and structure?
Basic difference between class and structure is that Structures are used to store data and a class defined both data and the functions that access that data.
Aparna
0 0
8
How to create my profile as technology(c++ programming) teacher?
C++ is not a pure OO language by any standards. It is extremely complex and confusing to a beginner to understand it properly. If you know C, you may find the syntax easier -- but if you want to learn...
Nilesh
what is constructor ?
Constructor is a special method which invoke automatically as instance created.
Avnish
What is the best IDE for C and C++ development?
If you're a student then Turbo C++ is best for C and C++ program + inbuilt C/C++ Graphics Function If you're a professional or working then Netbeans for C/C++ or Code:: Blocks is Best.
Balakrishnasingh
Which language is best, C, C++, Python or Java?
If you want to learn any languages C#, Java, ect. then must to learn C, C++ language as these are base or language to be strong in language skills. C++ is improved version of C language. C#, Java, J# and etc. which are improved version of C++.
Sribaghya
0 0
6

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

C, C++, JAVA Tutor
* Program to swap two numbers using a temporary variable with each statement explained with comments * #include // headerfile for cout statement using namespace std; //...

C++ Program-Working with constant using const keyword
//Header files #include<iostream.h>#include<conio.h> //Main function void main(){ //using const keyword to declare constants with a specific type const int len=10; const int br=5; const...
S

Necessity of Theory and Practical in Computer Science.
Upon studying a subject both theory and practical are important. Usually many schools concentrate more on theory and the marks not on the practical. Other and opposite kind of people prefer practical...

C Programming Language Basics - Easy way to learn
Computer - OverviewTodays world is an information-rich world and it has become a necessity for everyone to know about computers. A computer is an electronic data processing device, which accepts and stores...

Do You Know Size Of Empty Class and Reason?
Size of empty class is always 1 byte. Reason is, in order to differentiate one object to another object, the size of empty class is always 1 byte. See the below c++ code snippet. Here there are three...

Recommended Articles

Introduction C++ is an excellent programming language and many of the applications are written in C++ language. It has generic, object-oriented & imperative programming features, and also provides facilities for low-level memory manipulation. Successor of C language, it is an OOP (object oriented programming) language...

Read full article >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Looking for C++ Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C++ Language Classes?

The best tutors for C++ Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C++ Language with the Best Tutors

The best Tutors for C++ Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more