26 Nov
2018
26 Nov
'18
8:48 p.m.
On Mon, Nov 26, 2018 at 6:44 AM Marshall Clow via Boost < boost@lists.boost.org> wrote:
For example, should the following code cause a warning to be emitted?
auto p = std::make_unique<unsigned char>(0);
At least one popular compiler warns on this code, complaining about a truncation from int --> unsigned char, and a possible loss of data.
We spent a lot of time and effort in Boost.DateTime with this. See https://github.com/boostorg/date_time/pull/50 and others.
Exactly. I submit that it is neither possible or desirable to write code that will not result in warnings on some compiler. This is trivially true, because there is no standard for warnings. #pragma system_header is your friend.