What if I have a method that returns a CGFloat and that method could not find an expected number, I would like to return something like NSNotFound, but that is an NSInteger.
Whats the best practice for this ?
What if I have a method that returns a CGFloat and that method could not find an expected number, I would like to return something like NSNotFound, but that is an NSInteger.
Whats the best practice for this ?
You could use not a number (
NaN
).See
nan()
,nanf()
andisnan()
.However for these issues, where there is no clearly defined non-value (it's worse with integers), then I prefer to use the following method semantics: