In Bjarne's book, he said,
The insistence on strict bottom-up analysis implies that the return type is not used in overloading resolution.
It looks like that "bottom-up analysis" has sth to do with how the compiler parse the C++ codes.
What does he mean by saying this?
Regards.
"Bottom-up analysis" in particular means that the type of the sub-expression has to be determined before the type of containing exression, so for example if we have an expression g(f())
the type of f()
has to be determined before the compiler starts the overload resolution for g()
. This couldn't be done if we had:
int f();
float f();
void g(float);
// Even though g() accepts only float, bottom-up analysis implies that
// this information is not available during resolution of f().
g(f());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With