-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicolas Williams wrote:
> On Tue, Sep 29, 2009 at 11:21:30AM -0700, Roger Binns wrote:
>> Nicolas Williams wrote:
>>> If you move the cast to the left the warning should go away: 
>>> ((sqlite3_int64)(1L<<63))
>> And this is why making warnings go away leads to bugs.  The replacement
>> above will only work if sizeof(long)==sizeof(long long) which is not the
>> case on Windows in 64 bit mode or in 32 bit mode in general on any platform.
> 
> Where is long long entering the picture here? 

Really? The cast is to a 64 bit quantity.  Pretty much every compiler uses
'long long' to represent a 64 bit quantity (even in 32 bit mode), although
some also have __int64 and others int64_t depending on age and standards
compliance.

Another example of compilers whining is gcc saying that in one part of the
code, a parameter to memset could be zero (which usually indicates a
programming error).  Except the compiler is wrong as human inspection
proves.  Just because a warning is present does not mean it is right or that
the compiler is perfect.  Hiding these warnings is even more dangerous
because it obfuscates the original intention of the code.  (This is why a
universal no warnings policy can hurt.)

Demonstrate the code is wrong functionality (ie tests are broken) or that it
isn't written in a standards compliant way :-)  The compiler warnings could
help point to those locations.

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrCpjYACgkQmOOfHg372QScTgCeNILUcfFPq45ehdgfPQb+HdoI
D0kAn1AhMylW5G7+rm73rCbWWknAA+Bl
=FmBf
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to