3 ms·
>> I dislike implicit type conversions... What do you think of "auto" in C++ ?
by phkahler 6y ago
>> I dislike implicit type conversions...
What do you think of "auto" in C++ ?
- bl0b 6y ago'auto' is only available to use when the type of a variable can be automatically deduced from its initializer, meaning the declaration would be redundant. It has nothing to do with type conversions. edit: now I see what you mean in the context of adding assertions to make type conversions safer, and how there could be some parallels with auto for that
- dllthomas 6y agoIt's an example of making something explicit implicit. Whatever the answer, it won't surface a contradiction; but that doesn't mean it's not an interesting, obliquely related question.
- phkahler 6y agoIt's implicit declaration, which seems worse in some ways than implicit conversions. After a conversion you know what type you have even if not the type you started with.
- codys 6y agoNot the parent, but `auto` in c++ improves the situation wrt implicit conversions as variables now automatically get the type of the thing assigned to them. IOW: less unintentional implicit conversions.