2 ms·
What about with type conversion? https://en.cppreference.com/w/cpp/language/explicit_cast https://en.cppreference.com/w/cpp/language/explicit_cast
by syndicatedjelly 3y ago
What about with type conversion?
https://en.cppreference.com/w/cpp/language/explicit_cast https://en.cppreference.com/w/cpp/language/explicit_cast
- gpderetta 3y agoCasts don't change the type of an object. They might create a new object of another type from the first one. edit: I guess what you want to say is that implicit casts make a type system weak. But even there there is plenty of wiggle room: I think that everybody agree that implicitly converting the string "1" to an integer is bad (which is not allowed in C++). Narrowing conversions are arguably bad (they are sometimes allowed in C++), but some other implicit conversions are hard to argue against (int to long for example, or derived to base).