• 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
Re: debugging a static variable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debugging a static variable


  • Subject: Re: debugging a static variable
  • From: Sam McCandish <email@hidden>
  • Date: Sun, 20 Jun 2004 12:27:42 -0400

I'm not sure, but I think that you should put the static variable
withing the implementation.

Sam

On Sun, 20 Jun 2004 11:12:20 -0400, Koen van der Drift
<email@hidden> wrote:
>
> Hi,
>
> I have declared a static variable that can be used by all instances of
> the same class:
>
> static NSMutableDictionary *myDict = nil;
>
> @implementation MyObject
>
> - (id)init
> {
> if ( self = [super init] )
> {
> if ( ! myDict )
> {
> id aFile = [[NSBundle mainBundle]
> pathForResource:@"modifications" ofType:@"plist"];
> NSLog(@"aFile is %@", aFile);
> [self setMyDict: [[NSMutableDictionary alloc]
> initWithContentsOfFile: aFile]];
> }
> }
> }
>
> What happens is that every time init gets called, myDict is nil, so the
> part in brackets is called every time. I know that the dicttionary is
> created with the right contents, because [self setMyDict: ] gets
> called. But apparently it is not preserved. I tried to debug this, but
> I do not see myDict listed in the debugger's variable pane. Is there a
> way that I can track static variables in the debugger?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >debugging a static variable (From: Koen van der Drift <email@hidden>)

  • Prev by Date: debugging a static variable
  • Next by Date: Re: Some Questions...
  • Previous by thread: debugging a static variable
  • Next by thread: Re: debugging a static variable
  • Index(es):
    • Date
    • Thread