Re: Coding guidelines for braces + spaces - link 404's

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Kevin Burke <kevin(at)burke(dot)dev>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Coding guidelines for braces + spaces - link 404's
Date: 2021-09-20 11:48:29
Message-ID: 23af1b9f-37cf-261a-9667-5edfcfc38f6c@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20.09.21 05:37, Kevin Burke wrote:
> I have been working on a patch for Postgres. I'm curious about the
> suggested style for braces around if statements - some places don't
> include braces around an if statement body, if the if statement body is
> a single line.

Generally, the braces should be omitted if the body is only a single
line. An exception is sometimes made for symmetry if another branch
uses more than one line. So

if (foo)
bar();

but

if (foo)
{
bar();
}
else
{
baz();
qux();
}

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-09-20 11:51:00 Re: Logical replication timeout problem
Previous Message John Naylor 2021-09-20 11:46:59 Re: mark the timestamptz variant of date_bin() as stable