C++ Logo

sg12

Advanced search

Re: [ub] A proposal to define signed overflow submitted?

From: Hyman Rosen <hyman.rosen_at_[hidden]>
Date: Thu, 15 Mar 2018 01:24:06 -0400
On Wed, Mar 14, 2018 at 6:50 PM, Aaron Ballman <aaron_at_[hidden]>
wrote:
>
> Infinite loops are undefined behavior because you'd have to solve the
> halting problem in order to determine whether any given code path is
> dynamically reachable. So presence of an infinite loop is UB in order
> to allow optimizers to generate code assuming the behavior never
> occurs.


As soon as you mention the word "optimizer" you are lost.

Compilers don't need to solve anything. All they need to do is to model the
abstract machine on the underlying computer. If the abstract machine
executes
an infinite loop, so does the computer. As the programmer wrote it.

Received on 2018-03-15 06:24:30