We all know that C++ inherited unsafe semantics from C, but one would expect modern library features such as std::chrono to be carefully designed to avoid the old integer conversion bugs... right?

Not the case: it's very easy to silently cause truncation or overflow in correct-looking code, such as:


Try to get a compile-time diagnostic or at least a run-time error for this interface:

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!