Deutsch   English   Français   Italiano  
<20241213143911.00004af2@yahoo.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.lang.c
Subject: Re: goto considered helpful
Date: Fri, 13 Dec 2024 14:39:11 +0200
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <20241213143911.00004af2@yahoo.com>
References: <vi54e9$3ie0o$1@dont-email.me>
	<87ldwx10gv.fsf@bsb.me.uk>
	<vimtt4$27vv$1@dont-email.me>
	<86ser1kgp5.fsf@linuxsc.com>
	<vit69t$1qfgg$1@dont-email.me>
	<87ldwtzlc0.fsf@nosuchdomain.example.com>
	<vitjgg$1tukq$2@dont-email.me>
	<vj1bss$325uo$1@dont-email.me>
	<vj1h4i$335q1$2@dont-email.me>
	<vj1mhi$34p7h$1@dont-email.me>
	<vj1prj$35je4$1@dont-email.me>
	<vj7dup$he7i$1@dont-email.me>
	<vjasuj$17uod$1@dont-email.me>
	<vjc87h$1apid$1@paganini.bofh.team>
	<vjcbe1$1jns0$1@dont-email.me>
	<87wmg5x4b1.fsf@nosuchdomain.example.com>
	<vjd96b$1pbed$1@dont-email.me>
	<87jzc5wx3s.fsf@nosuchdomain.example.com>
	<vjdde8$1q2to$2@dont-email.me>
	<87frmtwuzq.fsf@nosuchdomain.example.com>
	<20241212144454.00003b83@yahoo.com>
	<87wmg4vaeb.fsf@nosuchdomain.example.com>
	<vjgsfq$3ajis$1@dont-email.me>
	<vjh4qc$3c7nb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 13 Dec 2024 13:39:12 +0100 (CET)
Injection-Info: dont-email.me; posting-host="34782675bbc9c0fc7c4f5e0641ba85f0";
	logging-data="3518754"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+yLd6YDFFpWzSL4Off4LFcl/FSrTvnezQ="
Cancel-Lock: sha1:yZkrlXwjhIDFKKIjT8qJ+LhrSMQ=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
Bytes: 3167

On Fri, 13 Dec 2024 11:12:13 +0000
bart <bc@freeuk.com> wrote:

> 
> 
> Some people don't like ordinary break either. There you could also 
> suggest using convoluted logic, or using a function instead But here 
> 'break' would be clearly be simpler and easier.
> 

Agreed.

> (I'd like to see a lambda example that is simpler than a two-level
> break or even a goto.)
>

It would not be simpler than goto, but a little easier to follow.
Relatively to two-level break, it's more general. Suppose, you have 3
levels of nested loops. Two-level break does not help for breaking
out of innermost loop *into* outermost loop.

The problem with lambda in this role is that it would be an overkill.
Also if one wants simplicity of writing then David's suggestion for
lambda without capture is not sufficient. On the other hand, lambda
with capture of full environment by reference is very easy to write,
but potentially very hard to follow and error-prone.

I am strictly inclined to think that goto is better than all
alternatives proposed so far.

> I've had a quick look through my codebases (not C), and I couldn't
> see an example of a numbered break. All I could find was the
> equivalant of:
> 
>     break              # the vast majority
>     break all
> 
> The latter breaks out of the outermost loop.
> 

For the reason explained above I don't like 'break all' idea.