From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public From: ell@access.digex.net (Ell) Subject: Re: Software landmines (was: Why C++ is successful) Date: 1998/08/21 Message-ID: <35dcf88a.20783164@news.erols.com>#1/1 X-Deja-AN: 383240220 Content-Transfer-Encoding: 7bit References: <902934874.2099.0.nnrp-10.c246a717@news.demon.co.uk> <6r1glm$bvh$1@nnrp1.dejanews.com> <6r9f8h$jtm$1@nnrp1.dejanews.com> <6renh8$ga7$1@nnrp1.dejanews.com> <6rf59b$2ud$1@nnrp1.dejanews.com> <35dc6bf4.5328251@news.erols.com> <35dfb9a8.4685477@news.erols.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@rcn.com X-Trace: winter.news.erols.com 903677661 4137 207.172.64.188 (21 Aug 1998 05:34:21 GMT) Organization: Universe Mime-Version: 1.0 Reply-To: ell@access.digex.net Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-08-21T00:00:00+00:00 List-Id: "John Goodsen" wrote: >Ell wrote in message <35dfb9a8.4685477@news.erols.com>... >> >>ell@access.digex.net (Ell) wrote: >>> >>>I'm willing to use 'goto' in time critical code where inlines are not >>>possible, to save stack winding and unwinding. Other than that I'd >>>rather use a procedure call and returns to get back. >>And even then, I try to organize the code so that I invoke 'goto >>:labelX' and jump to its target ':labelX' **within** a single >>procedure/function/module. >>I try **never** to cross procedure/funtion/module boundaries with a >>'goto', when I use it for time critical code. >It seems you are saying two things. You use goto to save stack >winding/unwinding in time critical code, yet you never goto around >a "stack boundary" (e.g. a procedure/function boundary). >How do you use goto's to increase efficiency in these cases then? I don't. I organize the relevant code - say for a sort - so that it all resides within a single procedure/function/module. I then subdivide the code by preceding logical blocks with a 'labelX'. And then I use 'goto' to navigate from block to block. Typically, I end most blocks of code headed by a ':labelX' with a 'goto' that leads to the first line of code immediately after where the 'goto' that entered the block was called. E.g. procedure xyz { // remember, code preceded by a ':labelX' must be entered // by an explicit 'goto labelX' call. it can *not* be entered by // default "flow control fall through" with MSDOS batch files. xysytr wekll jhgjie goto label 1 :label 2 // label 2 ceiue mhjyy return // exits procedure altogether :label 1 // label 1 lkjhgf touuy cnnfe goto label 2 // go back to next line after where this block // was called }; In the above, the final block of code to be executed exits the procedure with a 'return' Of course you can make things more interesting with a conditional constructs like 'if', 'case', or 'switch'. procedure xyz { xysytr wekll jhgjie goto label 2 :label 2 // label 2 ceiue mhjyy goto label 3 :label 3 // label 3 lkjhgf touuy cnnfe if x = 0 goto label 2 elseif x = 1 goto label 4 else return // leaves procedure endif :label 4 // label 4 hjuye mhyd lasdfl // procedure is left after this line }; Elliott -- :=***=: Objective * Pre-code Modelling * Holistic :=***=: Hallmarks of the best SW Engineering "The domain object model is the foundation of OOD." Check out SW Modeller vs SW Craftite Central : www.access.digex.net/~ell Copyright 1998 Elliott. exclusive of others' writing. may be copied without permission only in the comp.* usenet and bitnet groups.