Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!metro!usage.csd.unsw.oz.au!syacus!ian From: ian@syacus.acus.oz.au (Ian Joyner) Newsgroups: comp.lang.pascal Subject: Re: Gotos are ok Message-ID: <1991Feb4.230013.13124@syacus.acus.oz.au> Date: 4 Feb 91 23:00:13 GMT References: <11724@j.cc.purdue.edu> <1991Jan28.112029.50@csc.canterbury.ac.nz> Organization: ACUS Australian Centre for Unisys Software, Sydney Lines: 37 phys169@csc.canterbury.ac.nz writes: >That would be extremely useful, but is hard to implement, especially without a >frame pointer register. As I recall, Burroughs Algol did this "bad goto" quite >slowly, since the stack could contain all sorts of rubbish. Somebody mentioned a >version of Pascal (UCSD) that could do this. Maybe Borland may adopt it some Correct, Mark, Algol calls the MCP Block_exit procedure to clean up the stack, however many routine calls back. This may entail releasing arrays that have been set up as local variables, etc. (Hence why so many people use global arrays only in this language, ugh, but then it beats writing in assembler.) And it really is called a "bad goto". Shows you that you can't even trust a simple goto to generate a simple machine jump. One of the languages I enjoyed most, was the gotoless B1000 SDL. This solved the problem by optionally labelling blocks. eg do this forever % the only flavour of loop in the language. do that forever ..... if undo this; % Jump out of outer loop. ...... end that; ... end this; I don't recall whether you could "exit" multiple procedures by this method, but then you get the question of where do you exit to in a multiple recursive situation? People were always amazed when I could quite assuredly state that the whole operating system was written without one goto. That was easy to know, as SDL had no goto. -- Ian Joyner ACSNet: ian@syacus.oz ACUS (Australian Centre for Unisys Software) DNS: ian@syacus.oz.au Tel 61-2-390 1328 Fax 61-2-390 1391 UUCP: ...uunet!munnari!syacus.oz