[PD-dev] [ pure-data-Bugs-1371511 ] declaration of `y1' shadows a global declaration

Hans-Christoph Steiner hans at eds.org
Fri Oct 20 06:11:42 CEST 2006


On Oct 19, 2006, at 4:02 AM, IOhannes m zmoelnig wrote:

> Hans-Christoph Steiner wrote:
>> I think its a really bad idea to name functions using names that  
>> have existing in standard headers for decades, especially when  
>> that header is
>
> i do not recall any function in pd with a name "y1()".
> it is a simple stupid variable, with a _quite_ descriptive name  
> (e.g. "upperleft_y" would be more descriptive)

Its a variable, but its in g_canvas.h, so its public.  I  
wholeheartedly agree that variables/functions should have more  
descriptive names and y1 is not that.

>> used in the same project.  So must more C devs since gcc warns of  
>> this condition by default.  The warning should stay so that we  
>> don't get more such conditions.
>
> well, having variable shadowing others is not the end of the world.
> one of the benefits of variable shadowing is locality. at the same  
> time this is it's curse.
>
> after all, we have been discussing to get a similar mechanism into  
> pd for ages (think namespaces without prefixes!). maybe we should  
> rethink this.

If it happens that you need to use math.h's y1 and g_canvas.h is also  
included in your .c file, this could get quite annoying.  Does not  
make for readable code.  I can't see any benefits...

.hc

>
>
>> fixed soon doesn't seem like the good solution to me.  Instead it  
>> should be set to "Postponed", "later", "Remind", "Wont Fix",  
>> something that communicates why its being ignored and makes it  
>> easy to find in the future.
>
> i am with you.
>
> mfga.sdr
> IOhannes
>
> _______________________________________________
> PD-dev mailing list
> PD-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev


------------------------------------------------------------------------

If nature has made any one thing less susceptible than all others of  
exclusive property, it is the action of the thinking power called an  
idea, which an individual may exclusively possess as long as he keeps  
it to himself; but the moment it is divulged, it forces itself into  
the possession of everyone, and the receiver cannot dispossess  
himself of it.            - Thomas Jefferson






More information about the Pd-dev mailing list