• 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
Creation of constants
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creation of constants


  • Subject: Creation of constants
  • From: j o a r <email@hidden>
  • Date: Fri, 31 Oct 2003 10:35:11 +0100

According to Apple you should avoid using the #define preprocessor command to create constants:

<file:///Developer/Documentation/Cocoa/Conceptual/CodingGuidelines/ Articles/NamingIvarsAndTypes.html>

Why is that? And if that is true, then how would you create string constants to use for example as dictionary keys - they're only mentioning integer and floating point constants.

I usually do something like this:

#define MY_KEY @"MyKey"

Should it be:

const id kMyKey = @"MyKey";

?

j o a r
_______________________________________________
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.

  • Follow-Ups:
    • Re: Creation of constants
      • From: "Alastair J.Houghton" <email@hidden>
  • Prev by Date: Rendezvous not resolving on Panther, when compiled on Panther
  • Next by Date: Re: NSMutableArray Question
  • Previous by thread: Rendezvous not resolving on Panther, when compiled on Panther
  • Next by thread: Re: Creation of constants
  • Index(es):
    • Date
    • Thread