Re: Analyzer warning about garbage with double return values
Re: Analyzer warning about garbage with double return values
- Subject: Re: Analyzer warning about garbage with double return values
- From: Jean-Daniel Dupas <email@hidden>
- Date: Wed, 2 Sep 2009 11:07:40 +0200
So this is a false positive, as the analyzer should not warn though if
the deployment target is greater or equals to 10.5.
-- Jean-Daniel
Le 2 sept. 2009 à 10:58, Bjoern Knafla a écrit :
Its hidden in the following info box text from the link http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocObjectsClasses.html#//apple_ref/doc/uid/TP30001163-CH11-SW7
:
Note: The behavior of sending messages to nil changed slightly with
Mac OS X v10.5.
On Mac OS X v10.4 and earlier, a message to nil also is valid, as
long as the message returns an object, any pointer type, void, or
any integer scalar of size less than or equal to sizeof(void*); if
it does, a message sent to nil returns nil. If the message sent to
nil returns anything other than the aforementioned value types (for
example, if it returns any struct type, any floating-point type, or
any vector type) the return value is undefined. You should therefore
not rely on the return value of messages sent tonil unless the
method’s return type is an object, any pointer type, or any integer
scalar of size less than or equal to sizeof(void*).
Kind regards,
Bjoern
On 02.09.2009, at 10:50, Jean-Daniel Dupas wrote:
Le 2 sept. 2009 à 10:45, Jonas Maebe a écrit :
On 02 Sep 2009, at 10:07, Markus Spoettl wrote:
I thought it was safe to message nil-objects, the return value
would be 0 or the equivalent for the respective expression return
type. Is this not the case for double return values?
See http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocObjectsClasses.html#//apple_ref/doc/uid/TP30001163-CH11-SW7
, in particular the last bullet in that list.
Yes, and it does not concern double as it is in "aforementioned
types". (see second bullet)
If the method returns any pointer type, any integer scalar of size
less than or equal to sizeof(void*), a float, a double, a long
double, or a long long, then a message sent to nil returns 0.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden