• 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: Define NSError Domain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Define NSError Domain


  • Subject: Re: Define NSError Domain
  • From: Sherm Pendley <email@hidden>
  • Date: Fri, 23 Sep 2005 23:23:11 -0400

On Sep 23, 2005, at 9:19 PM, Johan Kool wrote:

What I don't understand
is how I tell the compiler that this enum belongs to my domain.
Shouldn't it know this to differentiate between errors that have the
same code?

I don't think it needs to. Codes only need to be unique with respect to other codes belonging to the same domain. I don't think it matters if the integer values of the codes in one domain overlap and/or duplicate with those in another.


Obviously there's the question of variable names, but the solution to that is the same as with any other globally-visible symbols in Objective-C - just prefix the names.

The compiler itself knows nothing of domains and error codes. It will check the type of variable you pass, and complain about it if you try to use a float or something like that, but that's the extent of it. The association between codes and the domain to which they belong is purely a matter of convention.

For that matter, it doesn't have to be declared in an enum either - you could use plain ints, literal numeric values, or #DEFINEd macros.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Define NSError Domain (From: Johan Kool <email@hidden>)
 >Re: Define NSError Domain (From: Andreas Mayer <email@hidden>)
 >Re: Define NSError Domain (From: Johan Kool <email@hidden>)
 >Re: Define NSError Domain (From: Sherm Pendley <email@hidden>)
 >Re: Define NSError Domain (From: Johan Kool <email@hidden>)

  • Prev by Date: Re: Define NSError Domain
  • Next by Date: How do I convert unix time to a date?
  • Previous by thread: Re: Define NSError Domain
  • Next by thread: Re: Define NSError Domain
  • Index(es):
    • Date
    • Thread