Re: trivial designated initializers - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: trivial designated initializers
Date
Msg-id a44072f3-15d8-4118-b6cb-0345b30ca3eb@eisentraut.org
Whole thread Raw
In response to trivial designated initializers  (Álvaro Herrera <alvherre@kurilemu.de>)
Responses Re: trivial designated initializers
List pgsql-hackers
On 28.01.26 13:20, Álvaro Herrera wrote:
>       {                            /* LockTupleKeyShare */
> -        AccessShareLock,
> -        MultiXactStatusForKeyShare,
> -        -1                        /* KeyShare does not allow updating tuples */
> +        .hwlock = AccessShareLock,
> +        .lockstatus = MultiXactStatusForKeyShare,
> +        /* KeyShare does not allow updating tuples */
> +        .updstatus = -1
>       },

You could spruce this up further like

[LockTupleKeyShare] = {
     .hwlock = AccessShareLock,
     ...
},
...

The comments "/* KeyShare does not allow updating tuples */" etc. seem 
repetitive and don't actually explain why -1 is an appropriate value. 
You could instead write a comment by the declaration of the updstatus 
field, like "set to -1 if the tuple lock mode does not allow updating 
tuples (see get_mxact_status_for_lock())".




pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Docs: Use non-default throughout the documentation
Next
From: Michael Paquier
Date:
Subject: Re: Correction to comment of brin_range_deserialize