Re: WIP pgindent replacement

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: David Christensen <david(at)endpoint(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP pgindent replacement
Date: 2012-07-12 18:37:58
Message-ID: 20120712183758.GD11063@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 22, 2011 at 10:16:28AM -0400, Bruce Momjian wrote:
> Andrew Dunstan wrote:
> > >> Further research shows that C89 explicitly dropped support for the old
> > >> K&R "=-" operator, so we probably *should* remove this in case it
> > >> introduces an unintended bug.
> > > Well, the point is if someone does use that, it isn't going to generate
> > > a pgindent error, but rather produce incorrect C code because =- is
> > > going to be changed. FYI, my gcc 2.95.3 allows =- and does work as
> > > intended.
> > >
> >
> > As intended by whom? If the effect of "x=4; x =- 1;" is to subtract 1
> > from x then that's simply wrong by C89. It should assign -1 to x. The
> > "=-" must be parsed as two operators in C89, assignment and unary minus.
> > pgindent should not under any circumstances change the semantics of the
> > program being indented, and that's what this transformation does for
> > compilers conforming to the standard we explicitly follow.
> >
> > What happens when your ancient gcc is told to apply the ansi standard?
>
> I see now that my test wasn't complete. You are right it assigns -1 so
> we can remove this from pgindent.

Per report form last year, removed from pgindent.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2012-07-12 19:15:15 Re: DELETE vs TRUNCATE explanation
Previous Message Tom Lane 2012-07-12 17:05:24 Re: [PATCH] lock_timeout and common SIGALRM framework