Article View: comp.lang.c
Article #1254Re: Taming The Switch-Statement
From: Lawrence D’Oliveiro
Date: Mon, 02 Nov 2026 02:49
Date: Mon, 02 Nov 2026 02:49
24 lines
2722 bytes
2722 bytes
On Sun, 01 Nov 2026 10:39:47 +0100, Rosario19 wrote: > On Tue, 13 Oct 2026 21:54:06 -0000 (UTC), Lawrence DÿOliveiro <> > wrote: > >> On Tue, 13 Oct 2026 07:23:40 -0000 (UTC), Waldek Hebisch wrote: >> >>> So what those counts indicate: majority of loops is simple, that >>> is have no early exit. Vast majority of early exits is done via >>> 'return'. >> >> My experience in my own C code is quite the opposite. Lots of loops >> have exits in the middle, leading me to use forms like “for (;;)”. >> I also try to avoid putting “return” anywhere other than the end of >> a function, to make it easier to see the flow of control. >> >> *cough* Nassi-Shneiderman diagrams *cough* > > my little experience is this for simple task loop are simple and > this is 95% of times than there algo need goto label for optimal > construction in terms of speed or number of execution statements If I understand that correctly, you are saying that in 95% of cases where you didn’t need break, you were able to make do without it.
Technical Details
Message-ID:
<11c8to4$2guvo$3@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11ae56o$cjlv$4@dont-email.me> <20261010230355.00005189@yahoo.com> <864iesjx6e.fsf@linuxsc.com> <11afvqt$2kloc$1@dont-email.me> <11ag37o$2ln0a$1@dont-email.me> <11agbsh$2pbk7$1@dont-email.me> <11aggaq$2qqh9$1@dont-email.me> <11agils$2s3tg$1@dont-email.me> <11agv1t$30q22$2@kst.eternal-september.org> <20261012220256.00003d07@yahoo.com> <11ajb95$3t8jj$1@dont-email.me> <20261012223144.00000f95@yahoo.com> <11akm9q$29tpl$1@paganini.bofh.team> <11am99u$ul56$2@dont-email.me> <702eel1084poj39dgkdomrjgtsfeobesvd@4ax.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Lawrence D’Oliveiro <ldo@nz.invalid> Newsgroups: comp.lang.c Subject: Re: Taming The Switch-Statement Date: Mon, 2 Nov 2026 02:49:40 -0000 (UTC) Organization: A noiseless patient Spider Lines: 24 Message-ID: <11c8to4$2guvo$3@dont-email.me> References: <11ae56o$cjlv$4@dont-email.me> <20261010230355.00005189@yahoo.com> <864iesjx6e.fsf@linuxsc.com> <11afvqt$2kloc$1@dont-email.me> <11ag37o$2ln0a$1@dont-email.me> <11agbsh$2pbk7$1@dont-email.me> <11aggaq$2qqh9$1@dont-email.me> <11agils$2s3tg$1@dont-email.me> <11agv1t$30q22$2@kst.eternal-september.org> <20261012220256.00003d07@yahoo.com> <11ajb95$3t8jj$1@dont-email.me> <20261012223144.00000f95@yahoo.com> <11akm9q$29tpl$1@paganini.bofh.team> <11am99u$ul56$2@dont-email.me> <702eel1084poj39dgkdomrjgtsfeobesvd@4ax.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Mon, 02 Nov 2026 02:49:41 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2653176"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Xq01g32gL6Cg559icG/H8"; posting-host="5a31d8056b64a207d32442e0db60c257" User-Agent: Pan/0.165 (Kostiantynivka) Cancel-Lock: sha1:o7g+9QGcq3UMaEv2I1BxUDMvZx4= sha256:P5P+fvLQyckRco/1U9toAtgd1bWtqEwMZmcmcYpGrOM= sha1:yNJIXZjKgv6DDUtfqY0uOKUylJ8= sha256:GyZfUyXjPzt3jsulRcZEj1nq83VaKrur+6CL/IYhgv0=