Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <v5anhl$oa76$1@dont-email.me>
Deutsch   English   Français   Italiano  
<v5anhl$oa76$1@dont-email.me>

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

Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: Fixing a sample from K&R book using cake static analyser
Date: Mon, 24 Jun 2024 05:01:07 +0200
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <v5anhl$oa76$1@dont-email.me>
References: <v53sl1$35qt7$1@dont-email.me> <v558hv$3dskb$1@dont-email.me>
 <20240623034624.135@kylheku.com>
 <20240624014040.c7a4b34e68ce734ff837868d@gmail.moc>
 <20240623160155.649@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 24 Jun 2024 05:01:09 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="8b06e05337e091ed4f227526767ebb5e";
	logging-data="796902"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18fKUxP2o2Gp5JE0R1ogiKW"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:oL8/G7h5pS7QcePveiOQ+6w1JZk=
In-Reply-To: <20240623160155.649@kylheku.com>
X-Enigmail-Draft-Status: N1110
Bytes: 2620

On 24.06.2024 01:04, Kaz Kylheku wrote:
> On 2024-06-23, Anton Shepelev <anton.txt@gmail.moc> wrote:
>> 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.

I was tempted to post the same comment before I noticed that:

> 
> I did that because there are declarations in the else case.

So I at least understand where Kaz was coming from and
abstained from a comment; I think it's a valid view.

> 
> I avoid mising declarations and statements, because I consider
> that a language misfeature.
> 
> In a block structured language, declarations should come first,
> then statements.

This is an age old concept, some programming languages even
require that (e.g. Simula, Pascal, just to name a few). But
starting with C++ I preferred the initialized declarations;
introduce objects where you use them, so that you have sort
of a "local scope"[*].

Janis

[*] Note: By that I mean that your context is kept locally
and compact, I don't mean a block scope, or similar.