GCC Undefined Behavior Sanitizer
monarch_dodra via Digitalmars-d
digitalmars-d at puremagic.com
Sat Oct 18 01:22:23 PDT 2014
On Friday, 17 October 2014 at 13:44:24 UTC, ketmar via
Digitalmars-d wrote:
> On Fri, 17 Oct 2014 09:46:48 +0000
> via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
>> In D (and C++) you would get:
>>
>> if (x < ((x+1)&0xffffffff)){…}
> perfect. nice and straightforward way to do overflow checks.
Besides, the code uses x + 1, so the code is already in undefined
state. It's just as wrong as the "horrible code with UB" we wère
trying to avoid in the first place.
So much for convincing me that it's a good idea...
More information about the Digitalmars-d
mailing list