From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dave Abrahams Newsgroups: gmane.emacs.devel Subject: Re: Should undefined behavior be encouraged in Emacs? Date: Mon, 03 Oct 2011 22:18:48 -0400 Message-ID: References: <4E89124D.8070405@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1317694740 10665 80.91.229.12 (4 Oct 2011 02:19:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 4 Oct 2011 02:19:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 04 04:18:56 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RAuau-0003bE-9w for ged-emacs-devel@m.gmane.org; Tue, 04 Oct 2011 04:18:56 +0200 Original-Received: from localhost ([::1]:35533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAuat-000106-Kt for ged-emacs-devel@m.gmane.org; Mon, 03 Oct 2011 22:18:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:45868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAuar-0000zq-3Y for emacs-devel@gnu.org; Mon, 03 Oct 2011 22:18:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RAuap-0007gA-RT for emacs-devel@gnu.org; Mon, 03 Oct 2011 22:18:53 -0400 Original-Received: from mail-vx0-f169.google.com ([209.85.220.169]:46583) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAuap-0007g6-Nz; Mon, 03 Oct 2011 22:18:51 -0400 Original-Received: by vcbfo14 with SMTP id fo14so18235vcb.0 for ; Mon, 03 Oct 2011 19:18:50 -0700 (PDT) Original-Received: by 10.220.178.198 with SMTP id bn6mr175845vcb.120.1317694730724; Mon, 03 Oct 2011 19:18:50 -0700 (PDT) Original-Received: from pluto.local (207-172-223-249.c3-0.smr-ubr3.sbo-smr.ma.static.cable.rcn.com. [207.172.223.249]) by mx.google.com with ESMTPS id jo8sm15791696vdb.20.2011.10.03.19.18.49 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 03 Oct 2011 19:18:49 -0700 (PDT) Original-Received: by pluto.local (Postfix, from userid 501) id CDCAD1066C3F; Mon, 3 Oct 2011 22:18:48 -0400 (EDT) In-Reply-To: (Richard Stallman's message of "Mon, 03 Oct 2011 21:55:14 -0400") User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.3 (darwin) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:144562 Archived-At: on Mon Oct 03 2011, Richard Stallman 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 http://www.boostpro.com