[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How undefined is undefined behaviour?
- From: tehtmi <tehtmi@...>
- Date: Fri, 4 Jun 2021 13:19:44 -0700
This point can surely be opposed, but I take the following perspective.
Suppose we call "next" a few times, then add a new index, then call
"next" again. Nothing formally connects the latter "next" call to the
former. It is not an error to call "next" with whatever index (we do not
need to start a "traversal" at the beginning nor proceed in any
particular order); it just returns the next index like the manual says.
The undefined behavior is only undefined based on an abstracted
perspective ("traversal") which cannot be known by the language
implementation, so the language implementation must not behave badly
(nor even throw an error).
The statement in the manual is just a friendly reminder that the order
of indices might change.