Boost logo

Boost :

Subject: Re: [boost] Current Guidance on Compiler Warnings?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2018-11-26 22:29:35


AMDG

On 11/26/2018 03:15 PM, Gavin Lambert via Boost wrote:
> On 27/11/2018 09:40, Emil Dotchevski wrote:
>> This is not what unsigned is for. You should generally use signed ints
>> even
>> if the value can't be negative.
>
> Why?  Other than being less typing (which is, I think, the real
> mistake), what reason is there for this?
>

signed integer overflow has undefined behavior.
unsigned integers wrap. This means that signed
integers give the compiler more scope for optimization
and/or runtime checks.

In Christ,
Steven Watanabe


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