• 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: Accessing programatically to attribute length in run-time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing programatically to attribute length in run-time


  • Subject: Re: Accessing programatically to attribute length in run-time
  • From: "Stephen Deken" <email@hidden>
  • Date: Wed, 21 Feb 2007 11:00:30 -0600

On 2/21/07, Txinto Vaz <email@hidden> wrote:
Thanks a lot again.

Glad to help. Looking over the code again, I notice that I've made at least two other errors. The lines:

   id tmp = [re constantValue];
   maxLength = [tmp isKindOfClass:@"NSString"] ? [tmp intValue] : tmp;

The comparison will always be false, because I meant to type [NSString
class], but the [tmp intValue] would assign an integer to the NSNumber
instance, which is almost universally bad.

You ought to just replace that whole thing with maxLength = [re
constantValue], since you're always going to be calling -[intValue] on
it later.  You could also probably get away with just a `return [[re
constantValue] intValue]` at that point as well, if you didn't want to
do any error checking.

--
Stephen Deken
email@hidden
_______________________________________________

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


References: 
 >Accessing programatically to attribute length in run-time (From: "Txinto Vaz" <email@hidden>)
 >Re: Accessing programatically to attribute length in run-time (From: "Stephen Deken" <email@hidden>)
 >Re: Accessing programatically to attribute length in run-time (From: "Txinto Vaz" <email@hidden>)

  • Prev by Date: Re: Accessing programatically to attribute length in run-time
  • Next by Date: bycopy in and NSDistantObject in return
  • Previous by thread: Re: Accessing programatically to attribute length in run-time
  • Next by thread: how to add ssl support in my cocoa application
  • Index(es):
    • Date
    • Thread