Re: [EXTERNAL] Re: Allow declaration after statement and reformat code to use it - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: [EXTERNAL] Re: Allow declaration after statement and reformat code to use it
Date
Msg-id 88e6a2fb-0fc7-3513-ad36-0cc2fd496a9b@dunslane.net
Whole thread Raw
In response to Re: [EXTERNAL] Re: Allow declaration after statement and reformat code to use it  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: [EXTERNAL] Re: Allow declaration after statement and reformat code to use it  (Ranier Vilela <ranier.vf@gmail.com>)
List pgsql-hackers
On 8/20/21 12:30 PM, Ranier Vilela wrote:
>
>
> There is a reason why GMs Brian Kernighan and Dennis Ritchie made the
> C89, less buggy.
> IMHO C99 makes it easy to make more mistakes.
> One more step and we won't even need to declare a variable.
>
>

I've used both styles in different languages over the years. I don't
know that one is a clearly better way, notwithstanding what various
theorists might say.

Note that in C89 it's fantastically easy to put the declaration as close
as you like to the first use of a variable. All it takes is a pair of
braces enclosing the variable scope.

Even if we were to relax our rules on this, making wholesale changes
along these lines and even more backpatching them seem out of the question.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com




pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o
Next
From: Ranier Vilela
Date:
Subject: Re: [EXTERNAL] Re: Allow declaration after statement and reformat code to use it