Notes for me in C++
The most vexing parse is a counterintuitive form of syntactic (syntax) ambiguity resolution in the C++ programming language.
In certain situations, the C++ grammar cannot distinguish between the creation of an object parameter and specification of a function's type. In those situations, the compiler is required to interpret the line as a function type specification.
Example 1:
void f(double my_dbl) {
int i(int(my_dbl));
}
In the above code the C compiler can misinterpret like this:
// A function named i takes an integer and returns an integer.
int i(int my_dbl);
Solution:
// declares a variable of type int
int i((int)my_dbl);
//or
int i(static_cast<int>(my_dbl));