• 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: Any way to tell if a pointer is an object?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any way to tell if a pointer is an object?


  • Subject: Re: Any way to tell if a pointer is an object?
  • From: Jerry Krinock <email@hidden>
  • Date: Sat, 24 Feb 2007 22:10:56 -0800
  • Thread-topic: Any way to tell if a pointer is an object?

on 07/02/24 20:51, Ricky Sharp at email@hidden wrote:

> whereas 'theObjectPointer' did.  For example, you should see a
> familiar class name in the 'name' field:
>
> (id)0x43aa50       0x43aa50
>      isa            0x402910
>         isa         0xa295fed8
>         super_class 0xa295a3b8
>         name        0xa295a3b8  NSCFArray
>         ...

Thanks, Ricky.  Indeed, I can see this in gdb.

Ah, but I should not have used the word "debug".  I'm a lazy Cocoa
programmer; I don't do a debug build and fire up gdb unless I've got
something really gnarly going on.  I should have asked this instead:

Is there any way to test whether or not a pointer points to an object before
sending it a message, to avoid the possible crash that will occur if it does
not point to an object?

For example, since documentation is not always complete, I often want to
examine the "(void*)contextInfo" that I get in a callback.  Doing

    NSLog(@"contextInfo = %@", contextInfo) ;

results in a crash if *contextInfo is not an object.

Jerry


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Any way to tell if a pointer is an object?
      • From: Sherm Pendley <email@hidden>
    • Re: Any way to tell if a pointer is an object?
      • From: "Clark Cox" <email@hidden>
References: 
 >Re: Any way to tell if a pointer is an object? (From: Ricky Sharp <email@hidden>)

  • Prev by Date: Re: Any way to tell if a pointer is an object?
  • Next by Date: Re: Implications of changing an app's bundle identifier
  • Previous by thread: Re: Any way to tell if a pointer is an object?
  • Next by thread: Re: Any way to tell if a pointer is an object?
  • Index(es):
    • Date
    • Thread