I'll agree that excessive worry is counterproductive.  But when I see warnings 
about pointer size mismatch and integer truncation I get worried.



You can actually have both you know, working and no warnings...I do it all the 
time.  I've got code with thousands of lines that can be compiled with 
-pedantic and such without problem.



I have worked on numerous codes where errors were identified by such 
warnings...so our experiences differ.



If you're going to decide to ignore it then put a comment in the code that says 
"don't bother to use options X/Y/Z to look for warnings...we have chosen to 
ignore them".





Michael D. Black

Senior Scientist

NG Information Systems

Advanced Analytics Directorate



________________________________
From: drhsql...@gmail.com [drhsql...@gmail.com] on behalf of Richard Hipp 
[d...@sqlite.org]
Sent: Friday, February 18, 2011 7:53 AM
To: General Discussion of SQLite Database
Cc: Black, Michael (IS)
Subject: EXT :Re: [sqlite] Compiler warnings in R-Tree code under Visual 
StudioExpress



On Fri, Feb 18, 2011 at 8:12 AM, Black, Michael (IS) 
<michael.bla...@ngc.com<mailto:michael.bla...@ngc.com>> wrote:
I'm of the opinion that all such warnings should be permanently fixed.  Such 
warnings do point to potential problems.
And not by disabling the warning but by fixing the code (explicit casts for 
example).

How many people try this and get worried about possible problems?  If you 
simply fix the code once all those people will feel a whole lot better when 
they crank up the warnings and see nothing.

I went through this exercise myself for SQLite at one point and looked at each 
and every warning to try and determine if there was a possible error caused by 
all the miscasts.

I don't understand the resistance to fixing these.  And I'd feel a whole lot 
better with somebody who KNOWS the code saying "yeah, explicit cast is OK here".

I do not recall an occasion where a compiler warning has helped us find an 
error in a released version of SQLite.  However, we have introduced errors in 
our efforts to fix compiler warnings.  Thus, in my experience, excessive worry 
over compiler warnings is counter-productive to software quality.  This is 
especially true of the warnings generated by MSVC.

So, which do you prefer:  Software that compiles without warning, or software 
that works?


Michael D. Black
Senior Scientist
NG Information Systems
Advanced Analytics Directorate



________________________________________
From: sqlite-users-boun...@sqlite.org<mailto:sqlite-users-boun...@sqlite.org> 
[sqlite-users-boun...@sqlite.org<mailto:sqlite-users-boun...@sqlite.org>] on 
behalf of Nick Shaw [nick.s...@citysync.co.uk<mailto:nick.s...@citysync.co.uk>]
Sent: Friday, February 18, 2011 3:50 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Compiler warnings in R-Tree code under Visual 
StudioExpress

Afriza N. Arief wrote:
> I tried to compile SQLite 3.7.5 with SQLITE_ENABLE_RTREE=1 and got the
following warnings:
>
> sqlite3.c(120736): warning C4244: '=' : conversion from 'double' to
'float', possible loss of data
> sqlite3.c(120749): warning C4244: '+=' : conversion from 'double' to
'float', possible loss of data
> sqlite3.c(120834): warning C4244: '=' : conversion from 'double' to
'float', possible loss of data
> sqlite3.c(121803): warning C4244: '+=' : conversion from 'double' to
'float', possible loss of data
> sqlite3.c(121804): warning C4244: '+=' : conversion from 'double' to
'float', possible loss of data
> sqlite3.c(121808): warning C4244: '=' : conversion from 'double' to
'float', possible loss of data
> sqlite3.c(121815): warning C4244: 'initializing' : conversion from
'double'
> to 'float', possible loss of data
> sqlite3.c(121914): warning C4244: 'function' : conversion from 'i64'
to 'int', possible loss of data
> sqlite3.c(121917): warning C4244: 'function' : conversion from 'i64'
to 'int', possible loss of data
>
> Thank you

Those are warnings, not errors, so won't prevent the build completing -
You can hide the warnings with a compiler pragma: #pragma warning
(disable: 4244), or you could edit the code itself and cast the doubles
explicitly as floats.

I don't think they're anything to be concerned about.  If I compile the
code in my project (without SQLITE_ENABLE_RTREE I should note) with
Level 4 warnings on the file properties in Visual Studio, I get a ream
of warnings, but they've yet to cause any problems at all (hence I
compile with Level 3 warnings so I don't keep seeing them).

Nick.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org<mailto:sqlite-users@sqlite.org>
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org<mailto:sqlite-users@sqlite.org>
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



--
D. Richard Hipp
d...@sqlite.org<mailto:d...@sqlite.org>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to