Re: [Proposal] Level4 Warnings show many shadow vars - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: [Proposal] Level4 Warnings show many shadow vars
Date
Msg-id 7b3ec6fb-a431-7353-854c-1e4aa2165247@gmail.com
Whole thread Raw
In response to RE: [Proposal] Level4 Warnings show many shadow vars  (Ranier Vilela <ranier_gyn@hotmail.com>)
Responses RE: [Proposal] Level4 Warnings show many shadow vars  (Ranier Vilela <ranier_gyn@hotmail.com>)
List pgsql-hackers

On 12/6/19 3:18 PM, Ranier Vilela wrote:
> Robert Haas wrote:
>> Maybe you want to post a few examples. It's hard to discuss in the abstract.
> I am working on the patch.
> I think this is a great example.
> I do not know if it is better to rename the local parameter, or if it should be renamed the global variable.
> 
> line: 68
> var char **synchronous_commit
> backend/commands/subscriptioncmds.c
> 
> global var declared here:
> /include/access/xact.h(82)

The local variables in subscriptioncmds.c named "synchronous_commit"
appear more times in that one file than the global variable appears
in total in the rest of the system, but that doesn't include other
references to the guc in code comments, in user facing strings, etc.

I think it is better to change this just in subscriptioncmds.c than
to change the global variable name everywhere else.  I also tend to
agree with you that shadowing the global variable is bad practice.

> One question, is it better to submit the patch on this topic, or create a new one?

You appear to be planning to submit lots of patches about lots of
different shadowed variables.  If you start a new thread for this
particular variable, it seems you'd probably do that again and again
for the other ones, and that might be tedious for readers of the
-hackers list who aren't interested.  To start, I'd prefer to see
the patch on this thread.



-- 
Mark Dilger



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: ssl passphrase callback
Next
From: Amit Kapila
Date:
Subject: Re: Windows buildfarm members vs. new async-notify isolation test