• 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: NSArray as a static
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray as a static


  • Subject: Re: NSArray as a static
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Tue, 2 Sep 2008 16:37:25 +0200


Le 2 sept. 08 à 16:29, Clark Cox a écrit :

On Tue, Sep 2, 2008 at 12:33 AM, Jean-Daniel Dupas
<email@hidden> wrote:

Le 2 sept. 08 à 00:13, Steven Noyes a écrit :


On Sep 1, 2008, at 1:38 PM, Jean-Daniel Dupas wrote:

Unlike java, Obj-C does not have the concept of class variable.
Your static variable is a classic C variable, and C variable are not
automatically initialized to NULL.
The first time you call init, relationshipMatch may contains anything and
may not be NULL, and so it will never be properly initialized.

Note: In "C", all static and global variables are initialized to zeros (or
NULL pointers). Local variables (auto variables from the stack) are not
initialized.


Steven

Yep, I just saw that static are an exception and are initialized to NULL or
0, but I'm not sure about "globals".

Globals have a static storage duration:

C99 6.2.4:

3 An object whose identifier is declared with external or internal
linkage, or with the
storage-class specifier static has static storage duration. Its
lifetime is the entire
execution of the program and its stored value is initialized only
once, prior to program
startup.

Thank you, it was the paragraph I missed.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSArray as a static (From: Richard Good <email@hidden>)
 >Re: NSArray as a static (From: Jean-Daniel Dupas <email@hidden>)
 >Re: NSArray as a static (From: Steven Noyes <email@hidden>)
 >Re: NSArray as a static (From: Jean-Daniel Dupas <email@hidden>)
 >Re: NSArray as a static (From: "Clark Cox" <email@hidden>)

  • Prev by Date: Re: NSArray as a static
  • Next by Date: Re: Valgrind alternative?
  • Previous by thread: Re: NSArray as a static
  • Next by thread: Re: NSArray as a static
  • Index(es):
    • Date
    • Thread