From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: C99 compliance for src/port/snprintf.c
Date: Wed, 15 Aug 2018 15:18:57 -0400
Message-ID: <20825.1534360737@sss.pgh.pa.us> (raw)
In-Reply-To: <dd48e765-9afe-4695-b2f4-f3cc0c1218e0@2ndQuadrant.com>
References: <17245.1534289329@sss.pgh.pa.us>
<CA+TgmoaanyYh9KG49yWdhzU72Ngh7XG5Gs9rtceQfBg6WFaybA@mail.gmail.com>
<9456.1534347706@sss.pgh.pa.us>
<20180815155237.pz5fgfmdo4cgqjta@alap3.anarazel.de>
<CA+TgmoYvHzFkwChsamwbBrLNJRcRq+fyTwveFaN_YOWUsRnfpw@mail.gmail.com>
<11138.1534349838@sss.pgh.pa.us>
<dd48e765-9afe-4695-b2f4-f3cc0c1218e0@2ndQuadrant.com>
Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> On 08/15/2018 12:17 PM, Tom Lane wrote:
>> Robert Haas <robertmhaas@gmail.com> writes:
>>> Personally, I'd prefer to
>>> continue avoiding // comments and intermingled declarations of
>>> variables and code on grounds of style and readability.
>> ... which I agree with.
> A decade or so ago I would have strongly agreed with you. But the
> language trend seems to be in the other direction. And there is
> something to be said for declaration near use without having to use an
> inner block. I'm not advocating that we change policy, however.
FWIW, the issue I've got with what C99 did is that you can narrow the
*start* of the scope of a local variable easily, but not the *end* of
its scope, which seems to me to be solving at most half of the problem.
To solve the whole problem, you end up needing a nested block anyway.
I do dearly miss the ability to easily limit the scope of a loop's
control variable to just the loop, eg
for (int i = 0; ...) { ... }
But AFAIK that's C++ not C99.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, andrew.dunstan@2ndquadrant.com, robertmhaas@gmail.com, andres@anarazel.de, pgsql-hackers@lists.postgresql.org
Subject: Re: C99 compliance for src/port/snprintf.c
In-Reply-To: <20825.1534360737@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox