• 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: message to nil? (very basic question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: message to nil? (very basic question)


  • Subject: Re: message to nil? (very basic question)
  • From: David Remahl <email@hidden>
  • Date: Sat, 19 Jan 2002 23:35:49 +0100

> Hi,
>
> a very basic question from a Cocoa/Obj-C newbie:
>
> Is it allowed to send a message to nil or will it crash or give some runtime
> errors or such things?
>
> Example: Do I have to check for nil, if I release an object?:
>
> if (myObject != nil) { // is this necessary?
> [myObject release]
> }
>
> Mani

Sending a message no nil is fine and can be done without ill-effects in
objective-C. Can't be done in Java. However, I notice people doing the check
for nil before releasing...Why? Is there a risk that this behaviour will be
changed in future revisions of the runtime?

/ david


References: 
 >message to nil? (very basic question) (From: Manfred Lippert <email@hidden>)

  • Prev by Date: message to nil? (very basic question)
  • Next by Date: Re: message to nil? (very basic question)
  • Previous by thread: message to nil? (very basic question)
  • Next by thread: Re: message to nil? (very basic question)
  • Index(es):
    • Date
    • Thread