3 ms·
You should use static_cast<>() and not C style cast. You should not care about signed/unsigned, use auto.
by shin_lao 12y ago
You should use static_cast<>() and not C style cast.
You should not care about signed/unsigned, use auto.
- cannam 12y agoI would prefer to use auto when iterating through the container, certainly. But much of the code I write is numerical stuff and "i" really is logically an integer rather than an iterator, arising as the result of some actual arithmetic. I find I have to do this quite often, and I'm not going to write static_cast<int>() every time. Yes, I can see why this isn't a good idea -- I'm pained by it myself. I'm just wondering what I might have overlooked among the possibilities available for this kind of code.
- shin_lao 12y agoIf you are writing numerical stuff, you should be using more explicit types such as std::uint32_t.