Xref: news2.mv.net comp.os.msdos.djgpp:2098 From: ake DOT oster AT mailbox DOT swipnet DOT se (Åke Öster) Newsgroups: comp.os.msdos.djgpp Subject: Re: When and how does longjmp() `clobber' variables? Date: 23 Mar 1996 08:48:05 GMT Organization: - Lines: 21 Message-ID: <4j0ds5$rjq@mn5.swip.net> References: NNTP-Posting-Host: dialup100-6-4.swipnet.se Mime-Version: 1.0 Content-Type: Text/Plain; charset=ISO-8859-1 NNTP-Posting-User: 57af7496bcb38a902b86939c9f6ffdbe To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article , eliz AT is DOT elta DOT co DOT il says... > > >On Thu, 21 Mar 1996, A.Appleyard wrote: >> main.cc: In function `int main(int, char **)': >> main.cc:33: warning: variable `class buffer * C' might be clobbered by >> `longjmp' or `vfork' > >I'd imagine that if you use longjmp in certain circumstances, some of the >destructors for variables that are on the parts of the stack which longjmp >unwinds aren't called. That's why the exceptions were introduced into >C++, right? No! The problem is that local variables that are put in machine registers by gcc, for example when it's optimizing the code, are not restored properly after a longjmp. There is a good reason for this, but at the moment I donät seem to remember it. Sorry. - Jonas Öster