• 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
Allowing nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Allowing nil


  • Subject: Allowing nil
  • From: "Jonathan E. Jackel" <email@hidden>
  • Date: Fri, 21 Mar 2003 09:42:28 -0500

This is probably more of a C question than a Cocoa question, but here goes.

I have written a category on NSScanner which includes a method with this
signature:

- (BOOL)scanUpToFirstString:(NSArray *)keywords
intoString:(NSString **)aString
hitString:(NSString **)theHit

The method scans up to the next keyword after the current scan location,
returns the scanned stuff by reference in aString and returns the keyword by
reference in theHit. Works perfectly fine -- unless I pass nil as the third
argument. It throws a bad access exception if I do.

NSScanner's "intoString" methods all allow nil when you don't care to keep
the scanned characters. I'd like to allow the same thing here with theHit.
How do I do it?

Jonathan
_______________________________________________
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: Allowing nil
      • From: Nathan Day <email@hidden>
  • Prev by Date: Re: Sheet over a sheet ?
  • Next by Date: Re: object instance names generated on the fly?
  • Previous by thread: Re: Sheet over a sheet ?
  • Next by thread: Re: Allowing nil
  • Index(es):
    • Date
    • Thread