4 ms·
You can't change the type of an object in C++ so I'm not sure how your definition applies. Generally "strong" vs "weak" typing[1] is an ill-defined an mostly
by gpderetta 3y ago
You can't change the type of an object in C++ so I'm not sure how your definition applies.
Generally "strong" vs "weak" typing[1] is an ill-defined an mostly useless definition.
[1] as opposed to static vs dynamic or safe vs unsafe.
- syndicatedjelly 3y agoWhat 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).