Zero-overhead principle
From cppreference.net
C++
C++ language
| General topics | ||||||||||||||||
| Flow control | ||||||||||||||||
| Conditional execution statements | ||||||||||||||||
| Iteration statements (loops) | ||||||||||||||||
|
||||||||||||||||
| Jump statements | ||||||||||||||||
| Functions | ||||||||||||||||
| Function declaration | ||||||||||||||||
| Lambda function expression | ||||||||||||||||
inline
specifier
|
||||||||||||||||
| Dynamic exception specifications ( until C++17* ) | ||||||||||||||||
noexcept
specifier
(C++11)
|
||||||||||||||||
| Exceptions | ||||||||||||||||
| Namespaces | ||||||||||||||||
| Types | ||||||||||||||||
| Specifiers | ||||||||||||||||
|
||||||||||||||||
| Storage duration specifiers | ||||||||||||||||
| Initialization | ||||||||||||||||
| Expressions | ||||||||||||||||
| Alternative representations | ||||||||||||||||
| Literals | ||||||||||||||||
| Boolean - Integer - Floating-point | ||||||||||||||||
| Character - String - nullptr (C++11) | ||||||||||||||||
| User-defined (C++11) | ||||||||||||||||
| Utilities | ||||||||||||||||
| Attributes (C++11) | ||||||||||||||||
| Types | ||||||||||||||||
typedef
declaration
|
||||||||||||||||
| Type alias declaration (C++11) | ||||||||||||||||
| Casts | ||||||||||||||||
| Memory allocation | ||||||||||||||||
| Classes | ||||||||||||||||
| Class-specific function properties | ||||||||||||||||
|
||||||||||||||||
| Special member functions | ||||||||||||||||
|
||||||||||||||||
| Templates | ||||||||||||||||
| Miscellaneous | ||||||||||||||||
제로 오버헤드 원칙 은 C++ 디자인 원칙으로 다음과 같이 명시합니다:
- 사용하지 않는 것에 대해서는 비용을 지불하지 않습니다.
- 사용하는 것은 직접 작성한 코드만큼 효율적입니다.
일반적으로, 이는 프로그래머가 해당 기능을 사용하지 않고 도입할 수 있는 것보다 시간이나 공간 측면에서 더 큰 오버헤드를 부과하는 어떤 기능도 C++에 추가되어서는 안 된다는 것을 의미합니다.
언어에서 제로 오버헤드 원칙을 따르지 않는 유일한 두 가지 기능은 runtime type identification 과 exceptions 입니다. 이것이 대부분의 컴파일러에서 이 기능들을 끌 수 있는 스위치를 포함하는 이유입니다.
외부 링크
| 1. | C++의 기초 - Bjarne Stroustrup |
| 2. | C++ 예외 처리와 대안들 - Bjarne Stroustrup |
| 3. | C++의 단편화 해소 - 예외 처리 와 RTTI 의 접근성과 사용성 향상 - Herb Sutter |
| 4. | Bjarne Stroustrup: 인공지능(AI) 팟캐스트에서의 C++ |