l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2002 Mar 17 07:03

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Where setjmp/longjmp went after C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Where setjmp/longjmp went after C

On Sat, 2002-03-16 at 13:25, Jeff Newmiller wrote:
> The attached two files demonstrate a rudimentary "structured
> setjmp/longjmp" that mimics the "exceptions" of Ada and C++ (and other
> languages).  I wrote an article about this in spring 1991 for C User's
> Journal, and my bad luck was that two other people beat me to the punch,
> so it never got published.  What I have here is pulled from memory, but I
> think it gets the idea across.
> The real value of this technique comes into play when everyone uses the
> same system... and you need language support to avoid certain problems
> with auto variables... so I would only recommend using this if you are
> stuck in C. :)

The real problem with using setjmp()/longjmp() these days:  C99 has
added a very cool type, the variable length array.  Unfortunately, the
standard declares that calling longjmp() when the call stack includes
functions which have defined VLAs which still exist, they may not be
deallocated by the stack-unwinding. :(  So, you get memory leaks...

That sucks.  The one thing I really dislike about the new C.  Other than
that, it rocks.


vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.