Article View: comp.lang.c.moderated
Article #2233Re: Some questions on coding
From: walter briscoe
Date: Mon, 11 Mar 1996 12:28
Date: Mon, 11 Mar 1996 12:28
38 lines
2241 bytes
2241 bytes
In article <4hqef9$1oj@solutions.solon.com>
hrubin@stat.purdue.edu "Herman Rubin" writes:
> Two questions have arisen. Both of these are in connection with
> statement labels and gotos, which I know will irritate many; these
> questions are raised in connection with certain types of programs
> in which the use of goto-less code must be less efficient.
First define your terms. My experience is that coding details rarely
have any significant effect on either the time or space efficiency of a
program .
>
> Question 1. Is there a quick way of using a variable label?
> The way it would be used is to identify the label to which one
> wants to transfer, and then have some other place or places
> transfer to that point? Transfers, loads, and stores take a
> significant part of the running time of the algorithm, and
> so something like setjmp and longjmp are to be avoided.
For this you need Fortran and assigned goto.
>
> Question 2. Is there a way of declaring "local", so that
> labels in one block of a coding unit can be the same as
> labels in another? The labels are within the block only,
> but the various blocks are connected with gotos, not calls.
>
Labels have function scope. You can connect blocks by them if you wish.
Having just had to port a program where there was a goto from outside a
nested loop to the inside of the loop - I don't have a clue what it is
meant to do - I would urge you to desist and, if you don't, to comment
liberally for the benefit of any poor fatherless person who may have to
maintain the code after you have left it.
--
walter briscoe
Technical Details
Message-ID:
<4i168s$gg@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4hqef9$1oj@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: walter briscoe <walter@wbriscoe.demon.co.uk> Newsgroups: comp.lang.c.moderated Subject: Re: Some questions on coding Date: 11 Mar 1996 06:28:12 -0600 Organization: Digital Solutions Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4i168s$gg@solutions.solon.com> References: <4hqef9$1oj@solutions.solon.com> Reply-To: walter@wbriscoe.demon.co.uk NNTP-Posting-Host: solutions.solon.com X-NNTP-Posting-Host: wbriscoe.demon.co.uk X-Newsreader: Demon Internet Simple News v1.30 X-Mail2News-Path: wbriscoe.demon.co.uk