• 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: n00b question about includes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: n00b question about includes


  • Subject: Re: n00b question about includes
  • From: "Juan Nunez-Iglesias" <email@hidden>
  • Date: Sat, 11 Aug 2007 10:55:54 +0200

Unless I'm misreading the question, just create a file, e.g.
constants.h, that has all your constants, and write

#import "constants.h"

near the start of all your files that need this.

Incidentally, I've always been taught to use global const variables
rather than #defines. e.g. instead of

#define FOO 5

write

const double FOO = 5;

Notice how in this case you clear up an ambiguity about the type of FOO.

Juan.

On 8/11/07, d2kagw <email@hidden> wrote:
> hey there,
>
> If I have tonnes of #defines declaring constants for my application
> (things like user preference keys, and model names etc) which I want
> to be made available to all the classes i'm writing (so I don't have
> to update all my classes every time I change/add a key)
> Is there a way I can include some file that contains these defines?
> that get included at build time?
>
> sorry for the uber n00b question.
>
> thanks for your help.
>
> _______________________________________________
>
> 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
>
_______________________________________________

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

  • Follow-Ups:
    • Re: n00b question about includes
      • From: Alastair Houghton <email@hidden>
References: 
 >n00b question about includes (From: d2kagw <email@hidden>)

  • Prev by Date: Re: Newbie question (if statement)
  • Next by Date: Re: Watching folders for new files and event handling based on that?
  • Previous by thread: Re: n00b question about includes
  • Next by thread: Re: n00b question about includes
  • Index(es):
    • Date
    • Thread