| Deutsch English Français Italiano |
|
<20240624014040.c7a4b34e68ce734ff837868d@gmail.moc> 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: 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:40:40 +0300
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <20240624014040.c7a4b34e68ce734ff837868d@gmail.moc>
References: <v53sl1$35qt7$1@dont-email.me>
<v558hv$3dskb$1@dont-email.me>
<20240623034624.135@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 24 Jun 2024 00:40:40 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c092b4272f57de9975d74d7342d26349";
logging-data="582965"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UXPmObX78qQSDTLQN5Roj+fuqqsf1bVg="
Cancel-Lock: sha1:u3wQu7CCMn27u+IXaE+bBzvQGjI=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Bytes: 1674
Kaz Kylheku:
> What scatter-brained drivel. Watch and learn:
>
> struct nlist *install(char *name, char *defn)
> {
> struct nlist *existing = lookup(name);
>
> if (existing) {
> return existing;
> } else {
When the if-branch ends with a return, the else-branch is
redundant, and its body shall be written bare, removing one
(useless) level of nesting and indentation. This is how
goto's and multiple return's (which are but a special case
of goto) help tidy up code.
--
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments