From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani
Philipp Stephani wrote:
>> Many modules will have needs similar to Emacs itself in
>> >that
>> >respect, and it would be better if they didn't have to rei= nvent this
>> >so-common
>> >wheel.
>> >
> But what should the interface be? There are only three possibilities i= n C:
> return a sentinel value, crash, longjmp.
There's a fourth possibility: do what Emacs does. Emacs defines its own=
throw-catch mechanism built atop C. C modules that need to cleanup when unw= ound
can do so by registering via the equivalent of record_unwind_protect, and E= macs
won't longjmp through them without cleaning up.=C2=A0 This already work= s for xmalloc
memory-exhaustion failures, and modules can just use the already-existing m= echanism.