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 method over-riding and how it is used ? if possible send with code with output or screen photo ?
Method over-riding : it is a technique in which more then one function with same name and same signature( similar type parameter) can present in program. in overriding a subclass method overrides the definition...
Sayyad
0 0
5
Why c++ introduced reference variable?
C++ references allow you to create a second name for the a variable that you can use to read or modify the original data stored in that variable.
Sunita
what is constructor ?
Constructor is a special method which invoke automatically as instance created.
Avnish
Is there any person who can teach me C++ without Money Fees?
Good question :) Free training is available on various sites online. But, if you would want to learn from an expert directly, there's a very slim chance that you might find some one who will teach for...
Kishan
Is C#, C++, Python, or JS better for game development?
All languages good for gamjng. But you can make 3d games in c# uaing unity software and it's very very interesting to work on it.
Mohit
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

How are C And C++ Different Form Each Other
1.C and C++ both have data types operator and conditional looping control statements. But the difference is that C++ has to object-oriented concepts which C programs do not have. Hence C program is like...

Advantages of C++ Language
Advantages of C++ - C++ is a profoundly convenient dialect and is frequently the dialect of decision for multi-gadget, multi-stage application advancement. - C++ is a protest situated programming dialect...

Creating a class in c++
Introduction Before we proceed with understanding as to how to create a class in c++, we need to first understand the what is a class. Definition : A class is a container of related data and methods...
M

Mahesh C

0 0
0

Memory Layout in C++ vis-a-vis Polymorphism and Padding bits.
I know there is no need for the knowledge of memory layout for a normal day-to-day development of C++. However, when someone goes in the bit/byte level of C++, he needs to look for such discussion. To...

Do (pre & post)Increment and decrement operators behave differently when printed in the same and different line in C++?
Before I explain anything,I would like you to run the following program. void main() {int j =10; cout<<“j before increment =“<<j; cout<<“++j =“<< ++j; cout<<“...

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