Deutsch   English   Français   Italiano  
<20240624013337.36fdb40f0766c6e1c8ce67c7@gmail.moc>

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

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Anton Shepelev <anton.txt@gmail.moc>
Newsgroups: comp.lang.c
Subject: Re: Fixing a sample from K&R book using cake static analyser
Date: Mon, 24 Jun 2024 01:33:37 +0300
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <20240624013337.36fdb40f0766c6e1c8ce67c7@gmail.moc>
References: <v53sl1$35qt7$1@dont-email.me>
	<v558hv$3dskb$1@dont-email.me>
	<20240623022343.ec355c69a3d9eb03ad4a50f2@gmail.moc>
	<878qywq7ou.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 24 Jun 2024 00:33:37 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c092b4272f57de9975d74d7342d26349";
	logging-data="582965"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/APWxwqjk/IE0Yfu/aZ0KX0ZLd1dvR51k="
Cancel-Lock: sha1:ntP6Fg6P1z91u57Lqop7TrTFqCk=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Bytes: 2222

Ben Bacarisse to Anton Shelelev:

> > Why are you so afraid of `goto' that you must emulate it
> > with `while' and `break'?
>
> Why are you so fond of them that you add three extra state
> variables that have to be (mentally and/or mathematically
> tracked) just understand this supposedly simply function?

Because my attempts to fix the function without the extra
variables proved even worse.

> This, to me, is a textbook case of why goto is harmful.  I
> have spend considerable time jumping up and down checking
> the state of all the variables and I am still not sure I
> follow what this supposedly simple function is doing.

I have tried to keep the structure simple: all the goto's
jump down, both the labels define isolated blocks, guared by
returns, to prevent fall-though.

> (And everyone seems keen on redundant casts.  Why?)

As I said, I could not test the function without extra work,
so I tried to change as little as possible.

-- 
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments