Boost logo

Boost :

Subject: Re: [boost] Current Guidance on Compiler Warnings?
From: Peter Dimov (lists_at_[hidden])
Date: 2018-11-24 15:52:57


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.)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk