[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gforth] exit() code in main.c
From: |
Bernd Paysan |
Subject: |
[gforth] exit() code in main.c |
Date: |
Tue, 22 Mar 2016 18:21:05 +0100 |
User-agent: |
KMail/5.1.2 (Linux/4.5.0-1-default; KDE/5.20.0; x86_64; ; ) |
We have several places in main.c, where non-recoverable bugs happen, and we
exit() on them. As Gforth can be used as library now, this is a bad idea - a
library should never exit, so the only word that should be allowed to exit is
main(). What to do?
C's exception handling with setjmp/longjmp is very poor, and can't be used
outside the engine, where we pass the attempt to do some primitive exception
handling to CATCH/THROW in Forth. So the probably best way is to define error
return values for all the functions that may fail.
--
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o ID: kQusJzA;address@hidden(dQ*
http://bernd-paysan.de/
- [gforth] exit() code in main.c,
Bernd Paysan <=