Why can I call a non-constexpr function inside a constexpr function?

The program is ill-formed and requires no diagnostic according to the C++11 draft standard section 7.1.5 The constexpr specifier paragraph 5 which says: For a constexpr function, if no function argument values exist such that the function invocation substitution would produce a constant expression (5.19), the program is ill-formed; no diagnostic required. and provides the … Read more

Purity vs Referential transparency

If I gather in one place any three theorists of my acquaintance, at least two of them disagree on the meaning of the term “referential transparency.” And when I was a young student, a mentor of mine gave me a paper explaining that even if you consider only the professional literature, the phrase “referentially transparent” … Read more

Unsequenced value computations (a.k.a sequence points)

Native operator expressions are not equivalent to overloaded operator expressions. There is a sequence point at the binding of values to function arguments, which makes the operator++() versions well-defined. But that doesn’t exist for the native-type case. In all four cases, i changes twice within the full-expression. Since no ,, ||, or && appear in … Read more

Why are global variables evil? [closed]

This has nothing to do with Python; global variables are bad in any programming language. However, global constants are not conceptually the same as global variables; global constants are perfectly harmless. In Python the distinction between the two is purely by convention: CONSTANTS_ARE_CAPITALIZED and globals_are_not. The reason global variables are bad is that they enable … Read more