Yes -- MSVC spits out a bunch of constant expression warnings. Most are bogus (e.g. while (1)). I looked at them all.
In this case if it's a compile-time option (which it is) wouldn't you normally put it in an #if block? It confused me when looking at the code as one or the other block will never execute....dead code. And...while looking at where it's called I noticed sqlite3Prepare16 const void *zSql, /* UTF-8 encoded SQL statement. */ sqlite3_prepare16 const void *zSql, /* UTF-8 encoded SQL statement. */ Should be UTF-16 in the comment? That would match the prototypes. Michael D. Black Senior Scientist NG Information Systems Advanced Analytics Directorate ________________________________________ From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Dan Kennedy [danielk1...@gmail.com] Sent: Monday, January 24, 2011 10:51 PM To: sqlite-users@sqlite.org Subject: EXTERNAL:Re: [sqlite] SQLite version 3.7.5 - code freeze On 01/25/2011 04:10 AM, Black, Michael (IS) wrote: > Is this if statement meant to be constant? Or should it be comparing the > requested encoding instead of SQLITE_UTF16NATIVE? > > SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){ > int c; > unsigned char const *z = zIn; > int n = 0; > > if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){ > while( n<nChar ){ > READ_UTF16BE(z, 1, c); > n++; > } > }else{ > while( n<nChar ){ > READ_UTF16LE(z, 1, c); > n++; > } > } > return (int)(z-(unsigned char const *)zIn); > } The ( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ) expression is supposed to be constant (for a given architecture). One branch of the "if" condition runs on bit-endian hosts, the other on little-endian. Is that the expression that is causing the warning? Dan. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users