Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue
Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue
- Subject: Re: Bindings, NSNumber equal to NIL and performing mathematical operations issue
- From: Ondra Cada <email@hidden>
- Date: Fri, 6 May 2005 20:00:50 +0200
Clark,
On 6.5.2005, at 15:34, Clark Cox wrote:
There really isn't. Unless you're expecting an object pointer, or
you're ignoring the return value, do not send messages to nil.
Ahem... that sounds a bit too positive :)
Do not *ever* try to send messages to nil if the return values is a
float or a struct.
On the other hand, you *can* (mind you, I am not saying you should,
but you *can* indeed) send messages to nil with int or BOOL (or long)
return values without any problem in a foreseeable future. Of course,
doing that, one should keep in mind it just *might* one day bring
problems. The actual probability though is very, very small. And it
should be pointed out such code did work all right ten years ago in
NeXTStep on Motorola 68K-based machines, and does work all right now.
http://www.livejournal.com/community/macosxdev/86254.html
Whilst in theory a different way of returning pointers and integers
may come, I would dare to argue that, given the existing *vast*
codebase which depends on things like
BOOL hasTitle=[[[self window] title] length]>0; // or even directly
"hasTitle= [[[self window] title] length];"!
working properly regardless there is a window or title at all, the
actual danger of any Apple compiler of a foreseeable future breaks
this compatibility is small enough to be quite negligible. Greater
danger with GNUStep, that's agreed.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden