error: narrowing conversion of '4323168000' from 'long int' to 'float' inside { } [-Wnarrowing] }; ^

用QT5编译QT4的工程,这个数4323168000,由long int 转换为 float转换错误。

 narrowing conversion of '4323168000' from 'long int' to 'float' inside { }

翻译:4323168000由long int转换为float 会有收缩的转换  
这个错误有C++11 narrowing 检测并报告
类似的有:error: constant expression evaluates to 1583035200 which cannot be narrowed to type 'float' (在一个float数组中,定义了0xffffffff 1583035200 )

note: insert an explicit cast to silence this issue

转换为float后,会不准确,对于一个costant常数,是不被允许的。可以加强制转换(显示转换)static_cast<float>。

即:{0, static_cast<float>(4294967295U), static_cast<float>(1583035200U)}

原文地址:https://www.cnblogs.com/Rainingday/p/13524156.html