티스토리 뷰
Inline function
In C++, Inline function increases efficient performance to prevent function call overhead, if a small function has to be repeated. However, the inline function is not a command, which means compiler may ignore the request. Additionally, even though every function are changed to the inline function, it doesn't guarantee that it increases efficiency all the time because compiler decides to perform it or not.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | inline int min(int x, int y) { return x > y ? y : x; } inline int MA(int m) { return m * m ; } int main() { cout << min(6, 8) << endl; // 6 cout << min(7, 2) << endl; // 2 cout << MA(3) << endl; // 9 return 0; } | cs |
'C++' 카테고리의 다른 글
Templates (Function Template & Class Template) in C++ (0) | 2018.11.10 |
---|---|
Exception handling (Try Throw and Catch) in C++ (0) | 2018.11.09 |
Copy constructor(Deep copy, Shallow copy) in C++ (0) | 2018.11.09 |
Inheritance and Overriding in C++ with simple example (0) | 2018.11.07 |
Constructor and Destructor in C++ (0) | 2018.11.06 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- code refactoring
- math.max
- spring boot application
- java
- 프로그래머스 알고리즘문제
- 알고리즘
- compareTo()
- Collection Framework
- substring()
- math.abs
- 프로그래머스 알고리즘
- HashMap
- Object type casting
- Javascript Algorithm
- hackerrank javascript solution
- hackerrank solution
- equals()
- string class in java
- easy algorithm
- algorithm
- ... in Javascript
- C++
- easy javascript algorithm
- repeat()
- rest parameter
- hackerrank
- 프로그래머스
- HackerRank Algorithm
- javascript
- hackerrank javascript
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함