Condition handling (was Re: gotos)
Larry Campbell
campbell at maynard.BSW.COM
Tue Apr 12 03:46:28 AEST 1988
The brouhaha about gotos being the only clean way to exit out of nested
loops emphasizes one of C's weakest areas -- condition handling. It is
difficult and tiresome in C to write reliable, robust system-level code
because of its lack of a modern condition handling facility.
By condition handling, I mean the ability to signal a condition (not to be
confused with the signal(2) system call) and have the stack unwound, executing
any declared condition handlers along the way. Good examples of this facility
can be found in Common Lisp, BLISS, and the DEC Western Research Lab's
Modula-2 compiler (which is Powell's plus a lot of good new stuff).
setjmp/longjmp are feeble and stunted in comparison.
Note that this is not a new idea. It was pioneered in the late 1960s
by Multics. I am given to understand the Primos (apparently patterned
after Multics) also has such a facility.
The lack of condition handling is one of the many reasons I dislike C.
--
Larry Campbell The Boston Software Works, Inc.
Internet: campbell at maynard.bsw.com 120 Fulton Street, Boston MA 02109
uucp: {husc6,mirror,think}!maynard!campbell +1 617 367 6846
More information about the Comp.lang.c
mailing list