[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Should undefined behavior be encouraged in Emacs?

From: Dave Abrahams
Subject: Re: Should undefined behavior be encouraged in Emacs?
Date: Mon, 03 Oct 2011 22:18:48 -0400
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.3 (darwin)

on Mon Oct 03 2011, Richard Stallman <rms-AT-gnu.org> wrote:

>     > In simple cases such as (goto-char -5), users tend to see what the
>     > behavior is, and are likely to write code that depends on it, even if
>     > it isn't documented.  Thus, leaving it undocumented doesn't mean that
>     > we can change it and nobody will notice.
>     If you make it a hard, inescapable error, that won't happen.
> That is true; this would pressure everyone to carefully make sure not
> to supply out-of-range arguments.  But is that goal really more
> desirable than the convenience of rounding out-of-range arguments?

I would say it depends on the argument and its meaning.  I remember when
I was working on a MIDI sequencer whose routines would assert that all
times used were nonnegative.  For my code, that was a major PITA.  I
would say the same probably applies to character positions.

Other arguments can't be so easily rounded (an int passed where a string
is expected), and probably some that can just shouldn't be
(e.g. indexing a vector).

Dave Abrahams
BoostPro Computing

reply via email to

[Prev in Thread] Current Thread [Next in Thread]