Boost logo

Boost :

Subject: Re: [boost] Current Guidance on Compiler Warnings?
From: Gavin Lambert (boost_at_[hidden])
Date: 2018-11-26 22:57:43


On 27/11/2018 11:29, Steven Watanabe wrote:
> 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.

I'm not aware of any compilers that actually do that, even in debug
mode. (Apart from ubsan, of course, but that also checks for unsigned
"overflow".)

Avoiding possible undefined behaviour sounds like a good reason to avoid
signed integers in general. (Except where actually required.)

(Not that unintended wrapping of unsigned integers is much better, but
at least it's less likely to summon Nyarlathotep.)


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