Hello Paul,
On Sat, 27 Dec 2025 11:51:24 -0800, Paul Eggert wrote:
> On 2025-12-26 11:44, Jₑₙₛ Gustedt wrote:
> > Hello Paul,
> >
> > On Wed, 24 Dec 2025 01:11:01 -0800, Paul Eggert wrote:
> >
> >> However, suppose f is defined this way:
> >>
> >> void
> >> f (int *b)
> >> {
> >> if (*b) // error condition ...
> >> exit (2); // ... that leads to termination
> >> *b = 1;
> >> }
> >>
> >> If [[reproducible]] allows this sort of thing, then it's not valid
> >> to do the optimization that I mentioned, because it will cause the
> >> program to exit with status 1 rather than status 2.
> >
> > Yes, but is this a problem? `f` is clearly not idempotent if `*b`
> > initially is `0`, so it is not unsequenced.
>
> Why is f not idempotent if there's no requirement that f must return?
Because replacing a call `f(x)` with two calls `(f(x), f(x))` has the
program behave differently.
Jₑₙₛ
--
:: ICube :::::::::::::::::::::::::::::: deputy director ::
:: Université de Strasbourg :::::::::::::::::::::: ICPS ::
:: INRIA antenne de Strasbourg :::::::::::::::::: Camus ::
:: INRIA PIQ program Strasbourg :::::::::: piq.inria.fr ::
:: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 ::
:: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::