• 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: Chuck Fleming <email@hidden>
  • Date: Thu, 21 Jun 2001 00:11:51 -0700

Hi,

The runtime has a mechanism for detecting this. You can register a
callback to detect messages being sent to nil.
void objc_setNilObjectMsgHandler(NilObjectMsgCallback
nilObjMsgCallback)
where the prototype for the call back is
typedef void (*NilObjectMsgCallback) (id nilObject, SEL selector)

See objc/objc-runtime.m (part of Darwin) for details. For gory details
look for the label LMsgSendNilSelf: in objc-msg-ppc.s.


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.

Chuck

"Damnit Jim, I'm a programmer not an engineer."


  • Follow-Ups:
    • Re: Sending messages to nil -- anyway to detect this?
      • From: Ali Ozer <email@hidden>
  • Prev by Date: Re: Webserver problem after installing WebObjects.
  • Next by Date: Re: Multiple NSTableView question
  • 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