Re: Using -Wshadow
От | Tom Lane |
---|---|
Тема | Re: Using -Wshadow |
Дата | |
Msg-id | 22920.1069708226@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Using -Wshadow (Peter Eisentraut <peter_e@gmx.net>) |
Список | pgsql-hackers |
Peter Eisentraut <peter_e@gmx.net> writes: > I'm not sure what the point is anyway. Shadowing is perfectly > well-defined and I've never heard of a real problem because of it. Well, shadowing a formal parameter with a local variable is most likely a mistake, and shadowing a local with a more-tightly-nested local is, if not an outright mistake, certain to confuse future maintainers. So I'd be in favor of getting rid of cases like that. I can't get excited about forbidding shadowing of globals by locals, though ... seems like that's practically giving up one of the advantages of having a block-structured language in the first place. BTW, what I find by experiment with gcc 2.95.3 is that local-shadowing-formal is warned of just with -Wall, if the local is declared at the function's outermost brace level, whether or not you say -Wshadow. So we already know we have none of those. regards, tom lane
В списке pgsql-hackers по дате отправления: