Thread: Windows Compile warnings: C4018 signed/unsigned mismatch and C4723 potential divide by 0

This shouldn't hold-up the impending release, but I thought I should mention
this.

I've always gotten these compiler warnings with VS2012 Express, and just
ignore them. Should we be setting a compile-level switch to surpress them,
or should they be fixed in the code?

Using command: nmake /f win32.mak CFG=Release ALL USE_LIBPQ=yes
With git commit:  d57e87caf0079e9aca8ea0c1ae8f6ea3fa81588b
<http://git.postgresql.org/gitweb/?p=psqlodbc.git;a=commit;h=d57e87caf0079e9aca8ea0c1ae8f6ea3fa81588b>

bind.c(940) : warning C4018: '<' : signed/unsigned mismatch
convert.c(474) : warning C4018: '>' : signed/unsigned mismatch
convert.c(1417) : warning C4018: '<=' : signed/unsigned mismatch
convert.c(1459) : warning C4018: '<' : signed/unsigned mismatch
convert.c(2670) : warning C4018: '<' : signed/unsigned mismatch
convert.c(2701) : warning C4018: '<' : signed/unsigned mismatch
convert.c(2752) : warning C4018: '<' : signed/unsigned mismatch
convert.c(3047) : warning C4018: '<' : signed/unsigned mismatch
convert.c(3413) : warning C4018: '<' : signed/unsigned mismatch
convert.c(4135) : warning C4018: '>=' : signed/unsigned mismatch
convert.c(4844) : warning C4018: '<' : signed/unsigned mismatch
dlg_specific.c(1476) : warning C4018: '<' : signed/unsigned mismatch
dlg_specific.c(1481) : warning C4018: '>=' : signed/unsigned mismatch
dlg_specific.c(1490) : warning C4018: '>=' : signed/unsigned mismatch
execute.c(1390) : warning C4018: '>=' : signed/unsigned mismatch
info.c(803) : warning C4018: '>=' : signed/unsigned mismatch
parse.c(306) : warning C4018: '<' : signed/unsigned mismatch
parse.c(505) : warning C4018: '<=' : signed/unsigned mismatch
parse.c(1125) : warning C4018: '<' : signed/unsigned mismatch
parse.c(1139) : warning C4018: '>=' : signed/unsigned mismatch
parse.c(1153) : warning C4018: '<' : signed/unsigned mismatch
parse.c(1500) : warning C4018: '>=' : signed/unsigned mismatch
pgtypes.c(1488) : warning C4018: '<' : signed/unsigned mismatch

c:\psqlodbc\convert.c(692) : warning C4723: potential divide by 0

qresult.c(936) : warning C4018: '>' : signed/unsigned mismatch
results.c(565) : warning C4018: '<' : signed/unsigned mismatch
results.c(625) : warning C4018: '<' : signed/unsigned mismatch
results.c(878) : warning C4018: '>=' : signed/unsigned mismatch
results.c(1338) : warning C4018: '<=' : signed/unsigned mismatch
results.c(1353) : warning C4018: '<=' : signed/unsigned mismatch
results.c(1768) : warning C4018: '>' : signed/unsigned mismatch
results.c(1806) : warning C4018: '<' : signed/unsigned mismatch
results.c(2189) : warning C4018: '>=' : signed/unsigned mismatch
results.c(2325) : warning C4018: '>=' : signed/unsigned mismatch
results.c(2429) : warning C4018: '>=' : signed/unsigned mismatch
results.c(2539) : warning C4018: '>=' : signed/unsigned mismatch
results.c(2647) : warning C4018: '<' : signed/unsigned mismatch
results.c(2784) : warning C4018: '<' : signed/unsigned mismatch
results.c(2800) : warning C4018: '<' : signed/unsigned mismatch
results.c(2824) : warning C4018: '<' : signed/unsigned mismatch
results.c(2965) : warning C4018: '>=' : signed/unsigned mismatch
results.c(2972) : warning C4018: '>=' : signed/unsigned mismatch
results.c(3110) : warning C4018: '<' : signed/unsigned mismatch
results.c(3286) : warning C4018: '>' : signed/unsigned mismatch
results.c(3297) : warning C4018: '>' : signed/unsigned mismatch
results.c(3308) : warning C4018: '>' : signed/unsigned mismatch
results.c(3408) : warning C4018: '<' : signed/unsigned mismatch
results.c(3433) : warning C4018: '>=' : signed/unsigned mismatch
results.c(3553) : warning C4018: '>=' : signed/unsigned mismatch
results.c(3629) : warning C4018: '>=' : signed/unsigned mismatch
results.c(3796) : warning C4018: '>=' : signed/unsigned mismatch
results.c(4019) : warning C4018: '<' : signed/unsigned mismatch
results.c(4213) : warning C4018: '<' : signed/unsigned mismatch
results.c(4308) : warning C4018: '>=' : signed/unsigned mismatch
results.c(4563) : warning C4018: '>=' : signed/unsigned mismatch
statement.c(1704) : warning C4018: '<' : signed/unsigned mismatch
odbcapi30w.c(186) : warning C4018: '>=' : signed/unsigned mismatch
odbcapi30w.c(311) : warning C4018: '>=' : signed/unsigned mismatch
odbcapi30w.c(382) : warning C4018: '>=' : signed/unsigned mismatch

Thanks...jack



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Windows-Compile-warnings-C4018-signed-unsigned-mismatch-and-C4723-potential-divide-by-0-tp5783481.html
Sent from the PostgreSQL - odbc mailing list archive at Nabble.com.


(2013/12/15 22:32), ljwilson wrote:
> This shouldn't hold-up the impending release, but I thought I should mention
> this.
>
> I've always gotten these compiler warnings with VS2012 Express, and just
> ignore them. Should we be setting a compile-level switch to surpress them,
> or should they be fixed in the code?

OK I pushed the change
     Suppress Windows Compile warnings: C4018 signed/unsigned mismatch
    by default.

You can change some CL options using CUSTOMCLOPT macro.

As for the C4723 warning, I didn't suppress them because I can verify
  the intentional 0-divide using the warnings.

regards,
Hiroshi Inoue

--
I am using the free version of SPAMfighter.
SPAMfighter has removed 1246 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len

Do you have a slow PC? Try a Free scan
http://www.spamfighter.com/SLOW-PCfighter?cid=sigen



Thanks! Much cleaner now when compiling.

...jack



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Windows-Compile-warnings-C4018-signed-unsigned-mismatch-and-C4723-potential-divide-by-0-tp5783481p5783552.html
Sent from the PostgreSQL - odbc mailing list archive at Nabble.com.