Skip navigation.
 
mlRe: NSString** in scanners
FROM : j o a r
DATE : Wed Jul 26 19:38:41 2006

On 26 jul 2006, at 19.15, D.K. Johnston wrote:

> Why do scanner methods such as:
>
>     scanCharactersFromSet:intoString:
>
> require an NSString** as their second parameter, rather than simply 
> an NSString*?


Because the method argument is used to _return_ a pointer to a 
NSString object to the caller of the method. This in contrast to how 
method arguments are used in the overwhelming majority of cases in 
Cocoa; where they're used by the caller to provide the method with an 
argument needed for the method to perform it's work.

You will find the same pattern used for many methods returning 
NSError, and can find a useful little code snippet here:

<http://developer.apple.com/documentation/Cocoa/Conceptual/
ErrorHandlingCocoa/CreateCustomizeNSError/chapter_4_section_4.html
>

j o a r

Related mailsAuthorDate
mlNSString** in scanners D.K. Johnston Jul 26, 19:15
mlRe: NSString** in scanners j o a r Jul 26, 19:38