Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSString compare:options:range: - which value to pass for no options?

I want to call [NSString compare:options:range:] and pass no options.

What should be the correct value to provide for the options parameter?

Both nil and NULL produce a warning in Xcode : "Incompatible pointer to integer conversion sending 'void *' to parameter of type ... "

like image 508
Marin Todorov Avatar asked Sep 01 '11 19:09

Marin Todorov


2 Answers

Just pass 0. Alternatively, if you've been around the Mac block a few times, you might catch yourself passing kNilOptions which is just another name for 0, but implies the relevant flagginess.

like image 176
Jonathan Grynspan Avatar answered Oct 05 '22 16:10

Jonathan Grynspan


You should pass 0. The options argument is a bit mask, which really means it's just an integer. That's also why the warning says "integer conversion".

like image 39
Lily Ballard Avatar answered Oct 05 '22 17:10

Lily Ballard