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

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
What is different between malloc and calloc?
The Diffrences are like-- malloc() takes a single argument (memory required in bytes), while calloc() needs two arguments. Secondly, malloc() does not initialize the memory allocated, while calloc() initializes...
Roopali
Are C Programmers currently in demand?
Ofcourse, C is alwasy in demand. In the beginning a lot of the big project developed in C language. Now a days, there are a lot of language in market and speciallity is growing in IT field. For a big organization...
Harsha
What is the use of virtual keyword in inheritance?
use of virtual keyword in inheritance-------> Multiple inheritance in C++ is a powerful, but tricky tool, that often leads to problems if not used carefully. This article will teach you how to use virtual...
Shabbir

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

Ask a Question

Related Lessons

Working with C/C++ applications
Inorder to learn C and C++ programming languages one can work with various editors available.To name a few are the most popular one is turbo c++, DEV C++, Eclipse, NetBeans. Here are the screen shots...

Object Oriented Programing
Object Oriented Programming Concepts: Object Oriented Programming follows bottom up approach in program design and emphasizes on safety and security of data. Features Of Object Oriented Programming: Inheritance: ...

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...

Software Development Training In Jaipur
Satyam Web Solution provides website designing &development and software designing &development training in Jaipur for various stream’s students. MCA 6 month Industrial Training/Internship B....

File Handling in C++ : Lesson 1 Data Persistence
Data persistence refers to the existence of data in the program. In other words, it means the life of data. Data is the most significant part of a program and it must be stored properly and easily retrieved...
J

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