2019 Ivannikov Ispras Open Conference (ISPRAS) | 2019
Constexpr: A Great Good but Wrong Idea
Abstract
The introduction of the constexpr feature in the C++11 standard has raised a great interest in the compile-time function execution in the programming languages communities. In this paper, we evaluate this feature and argue that while the compile-time evaluations are valuable optimization methods, its explicit support on the level of a programming language is a wrong decision. We show that compile-time evaluations must be enforced by the compiler automatically and transparently to the developer. Finally, we propose a programming language design principle stating that positive optimization hints must not be a part of programming language.