Re: Unportable coding in reorderbuffer.h

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unportable coding in reorderbuffer.h
Date: 2014-03-06 01:02:56
Message-ID: CA+TgmoaoUGswzrQJG9-DAE_Ei70GmpuEh50BR2WYO-vjSn_apQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 5, 2014 at 6:50 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> On 2014-03-05 17:40:56 -0500, Tom Lane wrote:
>> I don't believe that this is legal per C90:
>>
>> typedef struct ReorderBufferChange
>> {
>> XLogRecPtr lsn;
>>
>> /* type of change */
>> union
>> {
>> enum ReorderBufferChangeType action;
>> /* do not leak internal enum values to the outside */
>> int action_internal;
>> };
>>
>> ...
>>
>> That union field needs a name.
>
> You're absolutely right.
>
>> Our project standard is we compile on C90 compilers, and we're not
>> moving that goalpost just to save you a couple of keystrokes.
>
> While it's a good idea to try to save keystrokes the actual reason is
> that I just had somehow forgotten that it hasn't always been
> supported. I think it's not even C99, but C11...

Urgh. I know that isn't per project style, but I just plain missed it
while staring at these patches. At one point I thought of complaining
that separating the public and private values was not a worthwhile
endeavor, but I don't think I ever did. Still, I agree with Tom's
suggestion of dumping the distinction.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-03-06 01:03:16 Re: Unportable coding in reorderbuffer.h
Previous Message Andres Freund 2014-03-06 00:43:02 Re: Unportable coding in reorderbuffer.h