24 Nov
2018
24 Nov
'18
3:52 p.m.
Daniela Engert wrote:
Am 23.11.2018 um 20:58 schrieb Emil Dotchevski via Boost:
unsigned f();
void g( int x ) { if( x < f() ) //warning C4018: '<': signed/unsigned mismatch { .... } }
The only problem that I can see here is the fact, that this is flagged as a warning rather than an error. I know, this is technically correct but you simply cannot compare values from different value domains without preconditions.
Making it an error would be a useful first step towards making it work correctly. :-) (It's perfectly possible to compare a value in [INT_MIN, INT_MAX] with a value in [0, UINT_MAX], it's just that the standard says op< needs to do the wrong thing.)