• 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: nil messaging? Is it safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nil messaging? Is it safe?


  • Subject: Re: nil messaging? Is it safe?
  • From: Jonathan Wight <email@hidden>
  • Date: Thu, 26 Sep 2002 21:48:48 -0500

On 09/26/2002 20:20, "Ondra Cada" <email@hidden> wrote:

> On Friday, September 27, 2002, at 01:19 , Jonathan Wight wrote:
>
>> Which reminds me - I find the fact that the runtime effectively ignores
>> messages to nil/NULL to be a source of many hard to trace errors. Is it
>> possible to set the runtime or perhaps GDB up so that it'll break if you
>> attempt to send a message to nil?
>
> No, since it is a *VERY* common trick.
>
> More precisely: of course you can do that, but if you try, you'll return
> to the original behaviour as fast as possible. Anybody sends messages to
> nil (assuming nothing happens) *VERY* frequently.

I understand that - and appreciate it.

The kind of bug I'm talking about is where a method returns an object and
then you call methods on the returned object. If the original method fails
and returns null (and you've neglected to test for null) the subsequent
methods are not going to be executed. Instead of having to hunt this bug
down by hand, I'd love to be able to switch on a environment variable and
have all attempts to send messages to NULL logged.

I have no problems with the current behaviour, sending messages to NULL
makes a lot of sense in most circumstances (esp. lazy releases). I'd just
like to know when it's happening and I'm not expecting it.

Jon.
_______________________________________________
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: nil messaging? Is it safe?
      • From: Dave Camp <email@hidden>
    • Re: nil messaging? Is it safe?
      • From: Ondra Cada <email@hidden>
References: 
 >Re: nil messaging? Is it safe? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: nil messaging? Is it safe?
  • Next by Date: Re: nil messaging? Is it safe?
  • Previous by thread: Re: nil messaging? Is it safe?
  • Next by thread: Re: nil messaging? Is it safe?
  • Index(es):
    • Date
    • Thread