locklessinc.com

10 Problems with C++

Updated 5/27/2025

Excerpt

6.3. I agree that the rules for operator overloading are somewhat arbitrary, irregular and clumsy (e.g. pre-/postincrement or nothrow-new) 7. Templates syntax 7.1. I'm fine with templates as-is. Yes, I do write metaprograms. No, I would not want an imperative language unless I also get a compile time debugger. … 1. Run time type information 1.1. No real type information except the name 1.2. Non-standardized naming 1.3. No way to selectively disable (or enable) it causing lots of bloat, especially when polymorphism and templates are in the game 2. Lack of C99 features, in particular: 2.1. Variable-length arrays 2.2. Variadic macros 3. Standard library quirks 3.1. STL-iterators and verbose <algorithm> calls 3.2. Missing template 'find' method in std::set 3.3. STL implementations overusing inlining 3.4. STL implementations ignoring allocator type members

Source URL

https://locklessinc.com/articles/10_problems_with_cpp/

Related Pain Points

RTTI Performance and Binary Size Overhead

6

Runtime Type Information (RTTI) introduces performance overhead and increases binary size, which is critical in embedded systems. Some developers avoid RTTI due to security concerns like aiding reverse engineering, creating tension between pragmatic use and performance requirements.

performanceC++RTTI

STL Over-Inlining and Allocator Ignorance

5

STL implementations excessively inline code and ignore custom allocator type members, limiting optimization opportunities and making memory management customization ineffective in performance-critical scenarios.

performanceC++STL

Limited and Non-Standardized RTTI Type Information

4

C++ RTTI provides only the type name without full type information, and type naming is not standardized across compilers, limiting reflection capabilities and making type-based dispatch unreliable across platforms.

compatibilityC++RTTI

Missing C99 Features: Variable-Length Arrays

4

C++ lacks variable-length arrays (VLAs) from C99, forcing developers to use heap allocation or fixed-size arrays as workarounds, adding complexity and runtime overhead for stack-based dynamic sizing.

compatibilityC++C99

STL Iterator Verbosity and Missing Convenience Methods

3

STL iterators and algorithm calls are verbose and cumbersome. Common operations like finding elements in `std::set` lack template-based convenience methods, forcing developers to use verbose iterator-based approaches.

dxC++STL

Operator Overloading Rules Are Arbitrary and Irregular

3

C++ operator overloading rules are arbitrary, irregular, and clumsy. Examples include asymmetric pre/postincrement operator definitions and inconsistent nothrow-new behavior, making the feature unpredictable and error-prone.

dxC++