• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Why are my @private instance variables public?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why are my @private instance variables public?


  • Subject: Why are my @private instance variables public?
  • From: Matt Gough <email@hidden>
  • Date: Thu, 12 Aug 2004 16:41:35 +0100

I have just noticed that the @private instance variables of one of my classes are being treated as though they are @public. Does anyone know why this could be?

I tried replicating the problem in a new project, but couldn't.


After further investigation....

It seems as though the @private variables are public when compiling with Obj-C++, not plain Obj-C

A simple test case:

@interface Foo
	{
@private
	unsigned cacheValue;
	}
@end

@interface Bar : Foo
@end

@implementation Bar
-(void)someMethod
	{
	if (cacheValue == 7) // Allowed when compiling with Obj-c++
		;
	}
@end


Is there a compiler setting I need to twiddle?

Matt Gough
Softchaos Limited
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Why are my @private instance variables public?
      • From: Matt Gough <email@hidden>
  • Prev by Date: Re: Weird toolbar button behavior in 1.5?
  • Next by Date: Setting header search path
  • Previous by thread: Re: XCode does not stop at (Java) breakpoints...
  • Next by thread: Re: Why are my @private instance variables public?
  • Index(es):
    • Date
    • Thread