[NBLUG/talk] Invention of the Unary Number System

Andru Luvisi luvisi at andru.sonoma.edu
Mon May 19 21:49:00 PDT 2003


On Mon, 19 May 2003, Scott Doty wrote:
> On Mon, May 19, 2003 at 09:00:05PM -0700, Andru Luvisi wrote:
[snip]
> > C doesn't have exceptions.
>
> Is now a bad time to bring up setjmp/longjmp?
[snip]

Not especially.  I don't consider setjmp/longjmp to be the same as
exceptions.

I think of setjmp/longjmp as a different tool.  You can use it to
implement exceptions (I expect that the first C++ compilers did just
that), but you can use it for other purposes too.  One I think is cool is
described at http://home.pipeline.com/~hbaker1/CheneyMTA.html .  I've
heard of people implementing coroutines with setjmp/longjmp.  I think of
exceptions as being a more special purpose tool, and I also expect a
little more "clean up" from an exception handling mechanism than
setjmp/longjmp offer.

Getting back to the Romans, even in C++, I would expect that an "uncaught"
exception would be signaled to the OS by having a "catch all" clause in
the runtime library's _start() function that returns a non-zero value to
the OS when it catches an exception.

Andru
-- 
Andru Luvisi, Programmer/Analyst

Quote Of The Moment:
  Appel's method avoids making a large number of small trampoline bounces
  by occasionally jumping off the Empire State Building.
                  -- Henry G. Baker, "Cheney on the M.T.A."




More information about the talk mailing list