1

我正在使用 sqlite3.c 库。
它编译时带有 140 个转换警告。
我的设置有什么问题?

谢谢。

sqlite3.c
c:\Projects\Lib\sqlite3.c(11311) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11312) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11313) : warning C4244: '=' : conversion from 'double' to 'sqlite3_int64', possible loss of data
c:\Projects\Lib\sqlite3.c(11316) : warning C4244: '+=' : conversion from 'double' to 'sqlite3_int64', possible loss of data
c:\Projects\Lib\sqlite3.c(11430) : warning C4244: '=' : conversion from 'sqlite3_int64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11431) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11434) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11435) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11436) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11437) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11452) : warning C4244: '=' : conversion from 'sqlite3_int64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11454) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11499) : warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11505) : warning C4244: '=' : conversion from 'double' to 'time_t', possible loss of data
c:\Projects\Lib\sqlite3.c(11547) : warning C4244: 'return' : conversion from 'sqlite3_int64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11607) : warning C4244: '=' : conversion from 'double' to 'sqlite3_int64', possible loss of data
c:\Projects\Lib\sqlite3.c(11633) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11720) : warning C4244: '+=' : conversion from 'double' to 'sqlite3_int64', possible loss of data
c:\Projects\Lib\sqlite3.c(11722) : warning C4244: '+=' : conversion from 'double' to 'sqlite3_int64', possible loss of data
c:\Projects\Lib\sqlite3.c(11724) : warning C4244: '+=' : conversion from 'double' to 'sqlite3_int64', possible loss of data
c:\Projects\Lib\sqlite3.c(11726) : warning C4244: '+=' : conversion from 'double' to 'sqlite3_int64', possible loss of data
c:\Projects\Lib\sqlite3.c(11730) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11736) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11738) : warning C4244: '+=' : conversion from 'double' to 'sqlite3_int64', possible loss of data
c:\Projects\Lib\sqlite3.c(11742) : warning C4244: '+=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11781) : warning C4244: '=' : conversion from 'double' to 'sqlite3_int64', possible loss of data
c:\Projects\Lib\sqlite3.c(11950) : warning C4244: 'function' : conversion from 'u64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11981) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(11984) : warning C4244: '=' : conversion from 'sqlite3_int64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(12007) : warning C4244: '=' : conversion from 'sqlite3_int64' to 'char', possible loss of data
c:\Projects\Lib\sqlite3.c(12607) : warning C4244: 'return' : conversion from 'sqlite3_int64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(16030) : warning C4244: '=' : conversion from 'sqlite3_int64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(17184) : warning C4244: 'initializing' : conversion from 'sqlite_uint64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(17512) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(19310) : warning C4244: '=' : conversion from 'u64' to 'unsigned char', possible loss of data
c:\Projects\Lib\sqlite3.c(19313) : warning C4244: '=' : conversion from 'u64' to 'unsigned char', possible loss of data
c:\Projects\Lib\sqlite3.c(19320) : warning C4244: '=' : conversion from 'u64' to 'u8', possible loss of data
c:\Projects\Lib\sqlite3.c(25669) : warning C4244: 'initializing' : conversion from 'sqlite3_int64' to 'LONG', possible loss of data
c:\Projects\Lib\sqlite3.c(25670) : warning C4244: 'initializing' : conversion from 'sqlite3_int64' to 'LONG', possible loss of data
c:\Projects\Lib\sqlite3.c(25702) : warning C4244: 'initializing' : conversion from 'sqlite3_int64' to 'LONG', possible loss of data
c:\Projects\Lib\sqlite3.c(25703) : warning C4244: 'initializing' : conversion from 'sqlite3_int64' to 'LONG', possible loss of data
c:\Projects\Lib\sqlite3.c(25735) : warning C4244: 'initializing' : conversion from 'sqlite3_int64' to 'LONG', possible loss of data
c:\Projects\Lib\sqlite3.c(25736) : warning C4244: 'initializing' : conversion from 'sqlite3_int64' to 'LONG', possible loss of data
c:\Projects\Lib\sqlite3.c(28785) : warning C4018: '>=' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(29505) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(29511) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(29734) : warning C4244: '=' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(29747) : warning C4244: '=' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(29871) : warning C4244: '=' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(29887) : warning C4244: '=' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(30081) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(30360) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(30367) : warning C4244: '=' : conversion from 'i64' to 'Pgno', possible loss of data
c:\Projects\Lib\sqlite3.c(30370) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(30665) : warning C4018: '<=' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(31713) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(31771) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(31978) : warning C4018: '<=' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(33807) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(33809) : warning C4244: 'function' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(34527) : warning C4244: '=' : conversion from 'u16' to 'unsigned char', possible loss of data
c:\Projects\Lib\sqlite3.c(34623) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(35382) : warning C4244: '=' : conversion from 'u16' to 'unsigned char', possible loss of data
c:\Projects\Lib\sqlite3.c(35884) : warning C4018: '<=' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(36557) : warning C4018: '<=' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(36674) : warning C4244: '=' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(36679) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(36880) : warning C4244: '=' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(36887) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(37265) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(37267) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(37272) : warning C4244: 'function' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(37273) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(37343) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(37557) : warning C4018: '<=' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(37695) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(37891) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(37962) : warning C4244: '+=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(37964) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(38070) : warning C4244: '=' : conversion from 'u16' to 'u8', possible loss of data
c:\Projects\Lib\sqlite3.c(38150) : warning C4244: '=' : conversion from 'u16' to 'u8', possible loss of data
c:\Projects\Lib\sqlite3.c(39686) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(40231) : warning C4244: '+=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(40541) : warning C4244: '=' : conversion from 'i64' to 'Pgno', possible loss of data
c:\Projects\Lib\sqlite3.c(40590) : warning C4244: 'initializing' : conversion from 'sqlite3_int64' to 'Pgno', possible loss of data
c:\Projects\Lib\sqlite3.c(40671) : warning C4244: 'initializing' : conversion from 'i64' to 'Pgno', possible loss of data
c:\Projects\Lib\sqlite3.c(41144) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(41152) : warning C4244: 'function' : conversion from 'i64' to 'size_t', possible loss of data
c:\Projects\Lib\sqlite3.c(41153) : warning C4244: '+=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(41493) : warning C4244: '+=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(41688) : warning C4244: '=' : conversion from 'const i64' to 'double', possible loss of data
c:\Projects\Lib\sqlite3.c(41693) : warning C4244: '=' : conversion from 'const i64' to 'double', possible loss of data
c:\Projects\Lib\sqlite3.c(42031) : warning C4244: 'return' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(43995) : warning C4244: 'return' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(44011) : warning C4244: '+=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(44118) : warning C4244: '=' : conversion from 'u64' to 'u8', possible loss of data
c:\Projects\Lib\sqlite3.c(44132) : warning C4244: '+=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(44287) : warning C4018: '<' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(44382) : warning C4018: '>=' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(44444) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(44489) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(44827) : warning C4244: 'return' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(45006) : warning C4244: '=' : conversion from 'double' to 'i64', possible loss of data
c:\Projects\Lib\sqlite3.c(45036) : warning C4244: '=' : conversion from 'double' to 'u64', possible loss of data
c:\Projects\Lib\sqlite3.c(46720) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(46735) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(47061) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(47071) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(47168) : warning C4244: '=' : conversion from 'i64' to 'double', possible loss of data
c:\Projects\Lib\sqlite3.c(47961) : warning C4244: '=' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(47982) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(48020) : warning C4018: '>=' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(48038) : warning C4018: '<' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(48055) : warning C4018: '<' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(48235) : warning C4244: '+=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(48258) : warning C4244: 'function' : conversion from 'u64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(48270) : warning C4244: 'function' : conversion from 'u64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(48275) : warning C4244: '=' : conversion from 'u64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(48493) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(48497) : warning C4244: '=' : conversion from 'i64' to 'u8', possible loss of data
c:\Projects\Lib\sqlite3.c(48633) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(49420) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(49564) : warning C4244: '=' : conversion from 'i64' to 'u32', possible loss of data
c:\Projects\Lib\sqlite3.c(49567) : warning C4018: '>' : signed/unsigned mismatch
c:\Projects\Lib\sqlite3.c(50183) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(50189) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(50635) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(50636) : warning C4244: '=' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(62675) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(62711) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(63239) : warning C4244: 'function' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(63512) : warning C4244: 'initializing' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(63513) : warning C4244: 'initializing' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(63514) : warning C4244: 'initializing' : conversion from 'i64' to 'int', possible loss of data
c:\Projects\Lib\sqlite3.c(65536) : warning C4049: compiler limit : terminating line number emission
        Compiler limit for line number is 65535
c:\Projects\Lib\sqlite3.c(77234) : warning C4244: '=' : conversion from 'u16' to 'unsigned char', possible loss of data
4

3 回答 3

3

从 SQLite 网站:

有人说我们应该消除所有警告,因为良性警告掩盖了未来变化中可能出现的真实警告。这是真的。但作为回应,开发人员观察到所有警告都已在用于 SQLite 开发的编译器(各种版本的 GCC)中修复。编译器警告仅来自开发人员无权访问的编译器。

http://www.sqlite.org/faq.html#q17

于 2009-04-22T00:45:46.300 回答
2

在 Visual Studio 2005 或 2008 中,只需在 sqlite.c 上即可轻松配置编译器警告级别。这样,您可以在您编写的所有代码上使用一个很好的详细 /w4 并在 sqlite3.c 上使用 /w1,这样您就不会收到这些警告。在解决方案资源管理器中右键单击 sqlite.c,单击属性,向下钻取到配置属性 -> C/C++ -> 常规,然后从警告级别下拉列表中选择 /W1 或 /W0。

我没有在其他版本的 VS 或 VC++ 中尝试过这种方法。如果您提到您的特定编译器/IDE,那就太好了。

于 2009-12-16T22:09:47.497 回答
1

不,这不是你的设置。SQLite 写有很多警告。他们已经很多年没有修好了。没什么可做的,但忽略警告或贡献回补丁

于 2009-04-22T00:43:32.920 回答