Re: Dereferencing a pointer in ObjC?
Re: Dereferencing a pointer in ObjC?
- Subject: Re: Dereferencing a pointer in ObjC?
- From: Marcel Weiher <email@hidden>
- Date: Mon, 29 Jul 2002 09:42:25 +0200
On Monday, July 29, 2002, at 09:27 Uhr, Terry Simons wrote:
I have the following code:
if(@"Red" == [[myRadioMatrix selectedCell] title])
if ( [[[myRadioMatrix selectedCell] title] isEqual:@"Red"] )
Now... I can't do this because @"Red" is an NSString, but
[[myRadioMatrix selectedCell] title] is an NSString *.
Not true. @"Red" evaluates to the pointer to the object. If you try
this code, you will find that it type-checks OK. It still won't work
because you're just comparing pointers, not the string contents.
Is this bad style?
If code that doesn't work is bad style: yes ;-)
Should I be using some NSString comparison method instead?
Yes.
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
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.