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.

Allowing termination to happen under certain inputs would not mean
that the other part of the definition of the term can be ignored, no?
Such a function that terminates could not be idempotent if it
changes the pointed to argument to a state that is invalid for a
second call.

Thanks
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 ::

Reply via email to