http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56044



             Bug #: 56044

           Summary: Add dialect option to gobjc to prevent instance

                    variables from posing as local variables inside

                    methods.

    Classification: Unclassified

           Product: gcc

           Version: unknown

            Status: UNCONFIRMED

          Severity: enhancement

          Priority: P3

         Component: objc

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: dpapa...@gmail.com





Class instance variables in Objective-C can be accessed as if they were local

variables (without self->) inside class methods which luckily can be avoided

simply by not using the feature.  The only problem is that in that case you're

prevented from using an actual local variable or method argument with the same

name.  This can often be useful for instance in cases such as these:



-(SomeOmbject *)initWithBuffer: (char *buffer)

{

    [super init];

    self->buffer = buffer;



    return self;

}



In this case the compile would warn about variable shadowing and to avoid that

you have to find some other name for the variable which can get annoying.  It

would be nice therefore if this feature could be disabled for those that do not

like to use it.

Reply via email to