Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!balrog!smith From: smith@ctron.com (Larry Smith) Newsgroups: comp.lang.pascal Subject: Re: Turbo Pascal for Windows - Catch & Throw Message-ID: <1525@balrog.ctron.com> Date: 23 May 91 20:42:23 GMT References: <26994@adm.brl.mil> Sender: news@balrog.ctron.com Organization: Cabletron Systems Inc. Rochester, NH Lines: 28 Nntp-Posting-Host: glinda In article <26994@adm.brl.mil> Slomcenski.WBST129@xerox.com writes: > >A question was asked on the use of "Catch" and "Throw" in Turbo Pascal for >When a call to Catch is encountered in the code, the current state of the >program is captured into an 8 word array (TCatchBuf). This program >information is sufficient to later re-establish the state of the stack and But can these facilities be used to implement threads? Most setjmp/longjmp routines in C libraries these days can also save stack information, so you can allocate new stacks to be used for different chunks of code. This lets you implement Modula-style processes (c-style threads) pretty easily. Turbo C *does* store the required information, and I have seen a friends home-built thread package running on it. Can Turbo Pascal do the same? >One very critical caution should be observed when using Catch and Throw. >NEVER jump to a Catch that is at a more deeply nested scope level than the >Throw from which it came. This will corrupt the stack and will probably With this caveat, it doesn't sound like it, and that's really sad. Lack of threads is the one thing I truly need and the one thing Turbo Pascal seems to lack. Sigh. I really prefer Pascal, but it looks like C++ is going to be the choice. -- Larry Smith smith@ctron.com The usual disclaimer stuff...