Peter Gerwinski wrote:
Frank Heckenbach wrote:
I (Peter Gerwinski) wrote:
BTW, (Peter:) BP accepts "RunError" without an argument, so GPC should allow that, too. However, BP gives a "Runtime Error 0" then, which I don't like very much, since the exit status 0 usually means success. So, GPC should probably use some other error code...
Which one?
I'd say one in the "unsorted errors" range 0..99, perhaps 99 -- or 42. ;-)
What about 81 (assertion failure)?
Don't think so. It's got nothing do to with assertions -- or rather, it might have, but then, it might be something completely different. It's up to the programmer what s/he uses this error for...
I think 80 (call to predefined procedure `Bug') would be closer. AFAICS, there's no predefined procedure `Bug' currently. Does the standard or some dialect demand one? If not, we could use that and replace `Bug' by `RunError'. But we can just as well use a new error code (error codes are not a scarce resource -- we have the full Integer range available, and currently only nearly 200 out of the first 1000 are used ;-)...
And apropos assertions: it's easy to write a procedure for runtime assertions, like the following:
procedure Assert (Condition : Boolean; const Message : String); begin if not Condition then Runtime_Error_CString (81, Message) end;
(changing the text of the error message to "failed assertion `%s'"). Should I put this routine into the RTS? (This would also make it easier to change the error number, when the error numbers are rearranged.)
Frank
-- Frank Heckenbach, frank@fjf.gnu.de http://fjf.gnu.de/ PGP and GPG keys: http://fjf.gnu.de/plan