David Rowley <dgrowle...@gmail.com> writes: > On Thu, 12 Sept 2024 at 12:33, Peter Smith <smithpb2...@gmail.com> wrote: >> I normally build the code with warnings enabled (specifically, >> -Wshadow) which exposes many "shadowed" declarations.
> 0fe954c28 did add -Wshadow=compatible-local to the standard set of > complication flags. I felt it was diminishing returns after that, but > -Wshadow=local would be the next step before going full -Wshadow. I think that insisting that local declarations not shadow globals is an anti-pattern, and I'll vote against any proposal to make that a standard warning. Impoverished as C is, it does have block structure; why would we want to throw that away by (in effect) demanding a single flat namespace for the entire program? I do grant that sometimes shadowing of locals can cause bugs. I don't recall right now why we opted for -Wshadow=compatible-local over -Wshadow=local, but we could certainly take another look at that. regards, tom lane