• 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: Sending messages to nil -- anyway to detect this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sending messages to nil -- anyway to detect this?


  • Subject: Re: Sending messages to nil -- anyway to detect this?
  • From: Art Isbell <email@hidden>
  • Date: Tue, 19 Jun 2001 20:27:29 -1000

On Tuesday, June 19, 2001, at 06:15 PM, Michael P. Rogers wrote:

Is there a mechanism in Objective-C to detect when a message has been sent to a nil pointer? There are times when it'd be handy if the run-time system flagged it as an error.

There is no direct run-time support for this, but of course you could "turn on" such an error selectively:

if (receiver != nil)
[receiver doSomething];
else
[NSException raise:@"NilException" format:@"Message doSomething sent to nil object"];

Art


References: 
 >Sending messages to nil -- anyway to detect this? (From: "Michael P. Rogers" <email@hidden>)

  • Prev by Date: Re: Sending messages to nil -- anyway to detect this?
  • Next by Date: email auto-reply program
  • Previous by thread: Re: Sending messages to nil -- anyway to detect this?
  • Next by thread: Re: Sending messages to nil -- anyway to detect this?
  • Index(es):
    • Date
    • Thread