• 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
test if a pointer is pointing to a valid object or not?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

test if a pointer is pointing to a valid object or not?


  • Subject: test if a pointer is pointing to a valid object or not?
  • From: Ben Dougall <email@hidden>
  • Date: Tue, 28 Oct 2003 16:05:27 +0000

is there anyway to test if a pointer, that isn't NULL, is pointing to a valid object or not? when you have a valid pointer to an object, that pointer points to the isa of that instance. that isa points to the class that it's an instance of. so i tried:

if( [object isKindOfClass:[NSObject class]] )

but that crashed when it wasn't a valid object. is there anyway to safely test for a valid object?

thanks, ben
_______________________________________________
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: test if a pointer is pointing to a valid object or not?
      • From: "Alastair J.Houghton" <email@hidden>
  • Prev by Date: Re: Disk Copy
  • Next by Date: Re: Max size of an NSString
  • Previous by thread: Omni Framework Hell Again
  • Next by thread: Re: test if a pointer is pointing to a valid object or not?
  • Index(es):
    • Date
    • Thread