A
al
1. "Implicit conversion happens in three situations: expression, passing in
arguments of functions and returning expression from function." What is
"returning expression from function" here?
2. This is what my learning about conversion in C++:
Generally in C++, casting should be avoided.
Use explicit conversion rather than implicit conversion.
Use static_cast rather than dynamic_cast or reinterpret_cast, especially
when such conversion is safe during coding.
Use dynamic_cast with casting in a class hierarchy.
Is the above understanding correct conceptually?
3. Is the reason that reinterpret_cast should be avoided that it is system
dependent? What is system dependent here regarding reinterpret_cast? Is
there any other reason?
4. "The static_cast is available is available for a conversion that is
portable, well-defined, and invertible." Could someone help me understand
this statement better?
Thanks!
arguments of functions and returning expression from function." What is
"returning expression from function" here?
2. This is what my learning about conversion in C++:
Generally in C++, casting should be avoided.
Use explicit conversion rather than implicit conversion.
Use static_cast rather than dynamic_cast or reinterpret_cast, especially
when such conversion is safe during coding.
Use dynamic_cast with casting in a class hierarchy.
Is the above understanding correct conceptually?
3. Is the reason that reinterpret_cast should be avoided that it is system
dependent? What is system dependent here regarding reinterpret_cast? Is
there any other reason?
4. "The static_cast is available is available for a conversion that is
portable, well-defined, and invertible." Could someone help me understand
this statement better?
Thanks!