Re: [EXTERNAL] Re: Allow declaration after statement and reformat code to use it

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, Jelte Fennema <Jelte(dot)Fennema(at)microsoft(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Chapman Flack <chap(at)anastigmatix(dot)net>, "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [EXTERNAL] Re: Allow declaration after statement and reformat code to use it
Date: 2021-08-21 15:01:57
Message-ID: 88e6a2fb-0fc7-3513-ad36-0cc2fd496a9b@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2021-08-21 20:05:39 Re: [EXTERNAL] Re: Allow declaration after statement and reformat code to use it
Previous Message Dilip Kumar 2021-08-21 12:38:17 Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o