From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: Dynamic loading progress Date: Sat, 21 Nov 2015 08:33:26 +0000 Message-ID: References: <87egfzuwca.fsf@lifelogs.com> <876118u6f2.fsf@lifelogs.com> <8737w3qero.fsf@lifelogs.com> <831tbn9g9j.fsf@gnu.org> <878u5upw7o.fsf@lifelogs.com> <83ziya8xph.fsf@gnu.org> <83y4du80xo.fsf@gnu.org> <837fld6lps.fsf@gnu.org> <83610w5o97.fsf@gnu.org> <564FACF5.2080601@cs.ucla.edu> <564FBAA7.5030306@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b5d382c1bb7a7052508d9e9 X-Trace: ger.gmane.org 1448094829 20158 80.91.229.3 (21 Nov 2015 08:33:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Nov 2015 08:33:49 +0000 (UTC) Cc: aurelien.aptel+emacs@gmail.com, tzz@lifelogs.com, emacs-devel@gnu.org To: Paul Eggert , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 21 09:33:47 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a03c8-0007Y6-Hu for ged-emacs-devel@m.gmane.org; Sat, 21 Nov 2015 09:33:44 +0100 Original-Received: from localhost ([::1]:51480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a03c7-0003BV-NI for ged-emacs-devel@m.gmane.org; Sat, 21 Nov 2015 03:33:43 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a03c3-0003BD-9u for emacs-devel@gnu.org; Sat, 21 Nov 2015 03:33:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a03c2-0004AP-BE for emacs-devel@gnu.org; Sat, 21 Nov 2015 03:33:39 -0500 Original-Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:36503) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a03c0-00049w-Kd; Sat, 21 Nov 2015 03:33:36 -0500 Original-Received: by wmww144 with SMTP id w144so43886658wmw.1; Sat, 21 Nov 2015 00:33:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=gk97M/6PDGCYBjmB3TKvKGRo7vOIcO/iIux6IFBC8Zk=; b=iDuf8FTiYwqv2hEx2c6sRzzKpUbmROJLSCr3Hadslr93kUTrE6T88FtfrU8by+8dWM fbKVPDH4DkHvsoTklNTmKTg6CBcP9BuDaP1rdnY4C4rdeeBrzKN2gtIPw/helmFsRhTY V2XIITebclHQpYJzsNgQ0ffSuiooQuZMFgyJIFY0vGqyIIPQAa8UPYLjbjrK4cBn+TXs dawapOwtNMG2czECM56kdNDam5UYN5LGXGejApHSDuuTFVzAZ9/7OGvkN+0LQwoo6C3Q A+W7mCdURovc92FqQNxQhyFLWFOCLHiC8Z0Dk0Bx9ec62sOhrZIeuVlsXGq9+1lCtGfy VbCA== X-Received: by 10.194.19.163 with SMTP id g3mr18763192wje.166.1448094815990; Sat, 21 Nov 2015 00:33:35 -0800 (PST) In-Reply-To: <564FBAA7.5030306@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c09::229 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:194922 Archived-At: --047d7b5d382c1bb7a7052508d9e9 Content-Type: text/plain; charset=UTF-8 Paul Eggert schrieb am Sa., 21. Nov. 2015 um 01:28 Uhr: > Philipp Stephani wrote: > > Why, that's how malloc also behaves. > > Yes, of course. But this part of malloc's behavior is so painful that > Emacs code > typically never invokes malloc directly; it uses xmalloc, which is > guaranteed to > return non-null. Many modules will have needs similar to Emacs itself in > that > respect, and it would be better if they didn't have to reinvent this > so-common > wheel. > But what should the interface be? There are only three possibilities in C: return a sentinel value, crash, longjmp. Crashing prevents modules from doing their own error handling or degrading gracefully. longjmp is not possible in general because arbitrary C (and especially C++) code isn't prepared for it. So the sentinel value is the only option. This is also consistent with all the other environment functions that return a pointer. --047d7b5d382c1bb7a7052508d9e9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Paul E= ggert <eggert@cs.ucla.edu> = schrieb am Sa., 21. Nov. 2015 um 01:28=C2=A0Uhr:
Philipp Stephani wrote:
> Why, that's how malloc also behaves.

Yes, of course. But this part of malloc's behavior is so painful that E= macs code
typically never invokes malloc directly; it uses xmalloc, which is guarante= ed to
return non-null. Many modules will have needs similar to Emacs itself in th= at
respect, and it would be better if they didn't have to reinvent this so= -common
wheel.

But what should the interface be= ? There are only three possibilities in C: return a sentinel value, crash, = longjmp. Crashing prevents modules from doing their own error handling or d= egrading gracefully. longjmp is not possible in general because arbitrary C= (and especially C++) code isn't prepared for it. So the sentinel value= is the only option. This is also consistent with all the other environment= functions that return a pointer.=C2=A0
--047d7b5d382c1bb7a7052508d9e9--