Describe the differences between a call to an inline function member and a function that is not declared inline.. What advantages are there to inline? What disadvantages?
What will be an ideal response?
When a function is invoked, normally the function’s executable code has been placed to the side. The compiler puts a function call in the caller’s executable. The parameter passing mechanisms are set up so control is sent to the function’s code. There is only
one instance of the called function’s code no matter how many objects there are and
no matter how many times the member function is called.
In-line definitions do things differently. The compiler places the body of inline
functions in the execution stream at the place of the call with variable set in accord
with the parameter calling mechanism.. Inlining is done only for small functions. (In
fact, one of my compilers refuses to inline any function with a switch or loop.)
The advantage of inlined functions is that inline functions tend to be faster, at least for
small functions. The non-inline overhead of setting up the parameter passing
mechanism and transferring control is avoided. The disadvantages of inlined
functions are that the code will be larger if the inline function is called many times. The code will be slower for large inline functions than for equivalent non-inlined functions.
You might also like to view...
What does this code fragment store in d1 and d2 if the input file contains
``` string d1, d2; ... infile >>d1; getline( infile, d2 ); first line second line ``` a. d1 = "first" d2 = " line" b. d1 ="first" d2 = "second line" c. d1 = "first line" d2 = "second line" d. d1 = "first" d2 = " line second line"
A table ________ applies borders and fill colors to the entire table
A) style B) theme C) format D) effect
The publishing of printers in Active Directory requires a domain Group Policy configured to enable publishing.
Answer the following statement true (T) or false (F)
n the source-code file containing a class’s member function definitions, each member function definition must be tied to the class definition by preceding the member function name with the class name and ::, which is known as the:
a. Member definition linker. b. Class implementation connector. c. Source code resolver. d. Scope resolution operator.