Re: Undefined behaviour (Was: Definition of intervals as subsets...)
On Sat, Mar 14, 2009 at 5:08 PM, Michel Hack <hack@xxxxxxxxxxxxxx> wrote:
> Gabriel Dos Reis wrote:
>> I would think 'implementation defined' is better than 'undefined
>> behaviour'. The difference is that the implementation is required
>> to document the behaviour.
>
> Agreed, in cases where (a) the subject matter is peripheral to the
> standard as a whole and (b) there are different reasonable ways to
> handle the cases. Treatment of non-standard intervals is the prime
> example.
>
>> "Undefined behaviour" really taints the whole programs, and should
>> be avoided as much as possible.
>
> I agree with the "as much as possible" part, but not with the "tainted"
> part. Legitimate reasons for leaving behaviour undefined is when the
> situations can be avoided by the programmer, and the space of interactions
> is so large that it is not possible to tie an implementation to a realistic
> set of rules. Sometimes "it does what it does" is the only concise and
> complete description. The key point is that it must be possible to avoid
> the relevant circumstances. An example would be handling of overlapping
> structures.
We are dealing with computational mathematics. I find it hard
to believe that 'it does what it does' is an acceptable description
in a standard for interval arithmetic.
-- Gaby