Day 022 Compiler Warning 4018

This sort of "nit" irritates me. The archive build code sets the compiler switch /WX but does not disable warning 4018.

Fuction CatStrings:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
internal void
CatStrings(size_t SourceACount, char *SourceA,
           size_t SourceBCount, char *SourceB,
           size_t DestCount, char *Dest)
{
    // TODO(casey): Dest bounds checking!
    
    for(int Index = 0;
        Index < SourceACount;
        ++Index)
/...
produces warning 4018 for the expression Index < SourceACount. It doesn't on the stream. This should have "broken" the build I think.

Did I miss something? I bothers me when I don't replicate the build behaviro in my IDE version.

- tim
Are you using Visual Studio 2013 to compile, or another version?
VS 2008
(I'm doing a 32 bit build.)

FYI, FWIW, warning 2018 is the "signed/unsigned mismatch". That wasn't dropped later compiler versions, I don't think.

I really just wondered if it was disabled in the stream but not in the archive. If I shouldn't get it then I need to discover why. I can easily turn it off.

- tim
http://stackoverflow.com/question...ng-c4018-signed-unsifged-mismatch

A comment in this post states that, beginning with update 4, the size mismatch between int (32 bits) and size_t (64 bits) is suppressing the 4018 warning, and that MS has not promised to fix it. The confirm link is broken, but this was written by Hans Passant, a massive contributor to Stack Overflow who worked at Microsoft, so its probably legit.

So technically, your compiler is more correct than VS 2013 is. Woo!
Something seems "fishy" here.

I checked the VS 2015 Community version on another machine. That machine has day 40 code and the function doesn't looked like it changed. When that build uses the WX compiler flags the build fails and the warning is flagged.

So I think the 2015 compiler and the 2008 compiler do this. I can't understand how the stream didn't; it should have.

There was a macro added to do "safe" truncation but it doesn't apply here.

- tim