3.6 inline FUNCTIONS

Functions can be declared as inline. It is a request (not a directive) to complier to use (expand) function like a macro. It speeds up the execution of the programs. Compiler has the authority to ignore this request. In present day high-speed computers, this facility is not very important. What it means with respect to classes will be discussed later.

In early days of personal computers, clock speed was as small as 10 MHz. (Today a typical clock is 2.7 GHz, i.e. 2700 MHz.) Naturally, compiler writers (language designers) were always looking for speed-ups. When a function is called, computer is required to execute lot of extra instructions. We, as programmers, are unaware of them. If function is small, many extra instructions ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.