emacs-devel
[Top][All Lists]
Advanced

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

Re: Dynamic loading progress


From: Philipp Stephani
Subject: Re: Dynamic loading progress
Date: Sat, 21 Nov 2015 08:33:26 +0000



Paul Eggert <address@hidden> 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. 

reply via email to

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