Re: Unportable coding in reorderbuffer.h - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Unportable coding in reorderbuffer.h
Date
Msg-id CA+TgmoaoUGswzrQJG9-DAE_Ei70GmpuEh50BR2WYO-vjSn_apQ@mail.gmail.com
Whole thread Raw
In response to Re: Unportable coding in reorderbuffer.h  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: Unportable coding in reorderbuffer.h
List pgsql-hackers
On Wed, Mar 5, 2014 at 6:50 PM, Andres Freund <andres@2ndquadrant.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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Unportable coding in reorderbuffer.h
Next
From: Tom Lane
Date:
Subject: Re: Unportable coding in reorderbuffer.h