[Pyrex] Shadowing of C globals
Sam Rushing
sam-pyrex at rushing.nightmare.com
Mon Feb 6 07:19:08 CET 2006
On Sun, 2006-02-05 at 12:46 +1300, Greg Ewing wrote:
> Sam Rushing wrote:
>
> > + if maybe_shadowed != self.entry and maybe_shadowed.is_cglobal:
> > + print "Warning: local '%s' shadows C global: %s:%d:%d" % (
>
> What would be the recommended coding practice for
> avoiding this warning?
I'm not taking this position very strongly, but in my (largish, at least
for Pyrex) project I didn't run into any other real conflicts. My
recommendation would be to avoid it. But, I wouldn't be surprised if
other coding styles ran into it more often. It helps that the warning
only applies to C globals.
> If the answer is "change the local name so it doesn't
> shadow the global one", then you're effectively making
> it *illegal* (rather than just unrecommended) to
> shadow global names, if you want to be able to write
> warning-free code. I'd be reluctant to go that far.
I agree. My preference would be for a disabled-by-default warning.
-Sam
More information about the Pyrex
mailing list