Inline function

Veröffentlicht am: 24 October 2014
auf dem Kanal: Audiopedia
3,807
5

An inline function is a function in C and C++ programming languages qualified with the keyword inline which tells the compiler to substitute the body of the function inline by performing inline expansion i.e. by inserting the function code at the address of each function call thereby saving the overhead of function invocation and return (register saving and restore) by avoiding a jump to a sub-routine. The keyword inline function is similar to a macro as the compiler places a new copy of the inline function in each place it is called. Inline functions run a little faster than the normal functions as function-calling-overheads are saved, however, there is a memory penalty. If an inline function is called 10 times, there will be 10 copies of the function inserted into the code. Hence inline functions are best for small functions that are called often. The member functions of a class, if defined within the class definition, are inlined by default (no need to use the inline keyword); otherwise, the keyword is needed. The compiler may ignore the programmer’s attempt to inline a function, mainly if it is particularly large.


This video is targeted to blind users.

Attribution:
Article text available under CC-BY-SA
Creative Commons image source in video


Auf dieser Seite können Sie das Online-Video Inline function mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Audiopedia 24 October 2014 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 3,807 Mal angesehen und es wurde von 5 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!