为什么 "possible lack of precision" 不是编译器错误?
Why is "possible lack of precision" not a compiler error?
我在评论 并指出
In the embedded world, the warnings that worry me most are "possible loss of precision
" and "comparison between signed and unsigned
" warnings.
I find it difficult to grasp how many "programmers" ignore these (in fact, I am not really sure why they are not errors)
谁能解释为什么尝试将可能的夸脱放入经过认证的 pint 罐中不被视为错误?这肯定只是一场等待发生的灾难?
消息显示 "possible"。只有程序员才能知道这是否是一个真正的问题;编译器无法猜测。
"Surely it's just a disaster waiting to happen?" 言过其实。一些精度损失可能是无害的。我宁愿害怕over/underflow。通常你知道你在用你的数据类型做什么,编译器警告听起来像是一种善意的提醒。
我在评论
In the embedded world, the warnings that worry me most are "
possible loss of precision
" and "comparison between signed and unsigned
" warnings.I find it difficult to grasp how many "programmers" ignore these (in fact, I am not really sure why they are not errors)
谁能解释为什么尝试将可能的夸脱放入经过认证的 pint 罐中不被视为错误?这肯定只是一场等待发生的灾难?
消息显示 "possible"。只有程序员才能知道这是否是一个真正的问题;编译器无法猜测。
"Surely it's just a disaster waiting to happen?" 言过其实。一些精度损失可能是无害的。我宁愿害怕over/underflow。通常你知道你在用你的数据类型做什么,编译器警告听起来像是一种善意的提醒。