public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug objc/56044] New: Add dialect option to gobjc to prevent instance variables from posing as local variables inside methods.
@ 2013-01-19 11:09 dpapavas at gmail dot com
  2013-01-19 20:07 ` [Bug objc/56044] " pinskia at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: dpapavas at gmail dot com @ 2013-01-19 11:09 UTC (permalink / raw)
  To: gcc-bugs


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: unassigned@gcc.gnu.org
        ReportedBy: dpapavas@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.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-04-24 16:05 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-19 11:09 [Bug objc/56044] New: Add dialect option to gobjc to prevent instance variables from posing as local variables inside methods dpapavas at gmail dot com
2013-01-19 20:07 ` [Bug objc/56044] " pinskia at gcc dot gnu.org
2013-01-19 20:08 ` pinskia at gcc dot gnu.org
2013-01-19 22:27 ` dpapavas at gmail dot com
2013-01-19 22:29 ` dpapavas at gmail dot com
2013-01-20 11:10 ` dpapavas at gmail dot com
2013-07-02  8:13 ` dpapavas at gmail dot com
2013-07-02  8:17 ` dpapavas at gmail dot com
2014-02-05 12:25 ` dpapavas at gmail dot com
2014-02-05 17:55 ` joseph at codesourcery dot com
2014-02-05 20:21 ` dpapavas at gmail dot com
2014-02-05 20:42 ` joseph at codesourcery dot com
2014-04-24 16:05 ` mrs at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).