<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Nil</title>
	<atom:link href="http://ridiculousfish.com/blog/archives/2005/05/29/nil/feed/" rel="self" type="application/rss+xml" />
	<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/</link>
	<description>serious code</description>
	<lastBuildDate>Sat, 31 Jul 2010 18:07:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jack Waugh</title>
		<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/comment-page-1/#comment-34</link>
		<dc:creator>Jack Waugh</dc:creator>
		<pubDate>Fri, 24 Apr 2009 18:02:16 +0000</pubDate>
		<guid isPermaLink="false">http://ridiculousfish.com/blog/?p=14#comment-34</guid>
		<description>You guys (here and at http://unixjunkie.blogspot.com/2006/02/messaging-nil-in-objective-c.html ) talk as though there were no language standard for Objective-C.  I don&#039;t care because I don&#039;t swim in your world, but it&#039;s a sad state when you decide how to program by looking at an implementation of the language.</description>
		<content:encoded><![CDATA[<p>You guys (here and at <a href="http://unixjunkie.blogspot.com/2006/02/messaging-nil-in-objective-c.html" rel="nofollow">http://unixjunkie.blogspot.com/2006/02/messaging-nil-in-objective-c.html</a> ) talk as though there were no language standard for Objective-C.  I don&#8217;t care because I don&#8217;t swim in your world, but it&#8217;s a sad state when you decide how to program by looking at an implementation of the language.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ridiculous_fish</title>
		<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/comment-page-1/#comment-32</link>
		<dc:creator>ridiculous_fish</dc:creator>
		<pubDate>Wed, 21 Jun 2006 19:56:26 +0000</pubDate>
		<guid isPermaLink="false">http://ridiculousfish.com/blog/?p=14#comment-32</guid>
		<description>Key phrase there is &quot;to be returned in registers.&quot;  Small structs that are returned in registers are zeroed; other structs are not and cannot be.</description>
		<content:encoded><![CDATA[<p>Key phrase there is &#8220;to be returned in registers.&#8221;  Small structs that are returned in registers are zeroed; other structs are not and cannot be.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rpd</title>
		<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/comment-page-1/#comment-33</link>
		<dc:creator>rpd</dc:creator>
		<pubDate>Wed, 21 Jun 2006 07:11:26 +0000</pubDate>
		<guid isPermaLink="false">http://ridiculousfish.com/blog/?p=14#comment-33</guid>
		<description>Well, based on the revised universal binary guidelines, it looks like everything including floats and structs returns zero:

http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_tips/chapter_5_section_20.html

On Intel-based Macintosh computers, messages to a nil object always return 0.0 for methods whose return type is float, double, long double, or long long. Methods whose return value is a struct, as defined by the Mac OS X ABI Function Call Guide to be returned in registers, will return 0.0 for every field in the data structure. Other struct data types will not be filled with zeros. This is also true under Rosetta. On PowerPC Macintosh computers, the behavior is undefined.</description>
		<content:encoded><![CDATA[<p>Well, based on the revised universal binary guidelines, it looks like everything including floats and structs returns zero:</p>
<p><a href="http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_tips/chapter_5_section_20.html" rel="nofollow">http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_tips/chapter_5_section_20.html</a></p>
<p>On Intel-based Macintosh computers, messages to a nil object always return 0.0 for methods whose return type is float, double, long double, or long long. Methods whose return value is a struct, as defined by the Mac OS X ABI Function Call Guide to be returned in registers, will return 0.0 for every field in the data structure. Other struct data types will not be filled with zeros. This is also true under Rosetta. On PowerPC Macintosh computers, the behavior is undefined.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Gallagher</title>
		<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/comment-page-1/#comment-31</link>
		<dc:creator>Matt Gallagher</dc:creator>
		<pubDate>Thu, 05 Jan 2006 00:19:14 +0000</pubDate>
		<guid isPermaLink="false">http://ridiculousfish.com/blog/?p=14#comment-31</guid>
		<description>Trying to give other developers heart-attacks, Rob?

Fortunately: http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_tips/chapter_5_section_20.html

which says:

Do not rely on the nil-messaging feature for methods whose return types are float, double, long long, or struct. On an Intel-based Macintosh computer, the return value is undefined for Objective-C messages sent to nil for these return types.

Phew. No hideous debug/audit required.

P.S. Great blog, thanks ridiculous_fish!</description>
		<content:encoded><![CDATA[<p>Trying to give other developers heart-attacks, Rob?</p>
<p>Fortunately: <a href="http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_tips/chapter_5_section_20.html" rel="nofollow">http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_tips/chapter_5_section_20.html</a></p>
<p>which says:</p>
<p>Do not rely on the nil-messaging feature for methods whose return types are float, double, long long, or struct. On an Intel-based Macintosh computer, the return value is undefined for Objective-C messages sent to nil for these return types.</p>
<p>Phew. No hideous debug/audit required.</p>
<p>P.S. Great blog, thanks ridiculous_fish!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Winchester</title>
		<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/comment-page-1/#comment-30</link>
		<dc:creator>Rob Winchester</dc:creator>
		<pubDate>Sun, 19 Jun 2005 15:08:17 +0000</pubDate>
		<guid isPermaLink="false">http://ridiculousfish.com/blog/?p=14#comment-30</guid>
		<description>At WWDC one of the small (critical) tidbits they mentioned is that, on INTEL, you can no longer send messages to NIL... it will crash. Just a minor change there... ;-)</description>
		<content:encoded><![CDATA[<p>At WWDC one of the small (critical) tidbits they mentioned is that, on INTEL, you can no longer send messages to NIL&#8230; it will crash. Just a minor change there&#8230; <img src='http://ridiculousfish.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ridiculous_fish</title>
		<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/comment-page-1/#comment-29</link>
		<dc:creator>ridiculous_fish</dc:creator>
		<pubDate>Tue, 07 Jun 2005 19:09:14 +0000</pubDate>
		<guid isPermaLink="false">http://ridiculousfish.com/blog/?p=14#comment-29</guid>
		<description>Thanks, Daniel.  I had noticed that Monday - the PDF document is incorrect and should be fixed.</description>
		<content:encoded><![CDATA[<p>Thanks, Daniel.  I had noticed that Monday &#8211; the PDF document is incorrect and should be fixed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Ericsson</title>
		<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/comment-page-1/#comment-28</link>
		<dc:creator>Daniel Ericsson</dc:creator>
		<pubDate>Mon, 06 Jun 2005 20:30:37 +0000</pubDate>
		<guid isPermaLink="false">http://ridiculousfish.com/blog/?p=14#comment-28</guid>
		<description>&quot;On a Macintosh using an Intel microprocessor, Objective-C messages sent to nil return garbage for return values that are typed as float or double. On a Macintosh using a PowerPC microprocessor these messages return 0.0.&quot;

Page 46.

http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary.pdf</description>
		<content:encoded><![CDATA[<p>&#8220;On a Macintosh using an Intel microprocessor, Objective-C messages sent to nil return garbage for return values that are typed as float or double. On a Macintosh using a PowerPC microprocessor these messages return 0.0.&#8221;</p>
<p>Page 46.</p>
<p><a href="http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary.pdf" rel="nofollow">http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary.pdf</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wim L</title>
		<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/comment-page-1/#comment-27</link>
		<dc:creator>Wim L</dc:creator>
		<pubDate>Wed, 01 Jun 2005 20:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://ridiculousfish.com/blog/?p=14#comment-27</guid>
		<description>Ages ago, IIRC, it was *documented* behavior that [nil blah...] was OK and would return nil if the method returned an id (or other object pointer). And of course, on machines where pointers and ints are register-compatible it works for ints as well. As you point out it&#039;s easy to get sloppy and use it for a float or a struct and end up with hard-to-reproduce behaviorâ€¦</description>
		<content:encoded><![CDATA[<p>Ages ago, IIRC, it was *documented* behavior that [nil blah...] was OK and would return nil if the method returned an id (or other object pointer). And of course, on machines where pointers and ints are register-compatible it works for ints as well. As you point out it&#8217;s easy to get sloppy and use it for a float or a struct and end up with hard-to-reproduce behaviorâ€¦</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ridiculous_fish</title>
		<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/comment-page-1/#comment-26</link>
		<dc:creator>ridiculous_fish</dc:creator>
		<pubDate>Wed, 01 Jun 2005 02:11:48 +0000</pubDate>
		<guid isPermaLink="false">http://ridiculousfish.com/blog/?p=14#comment-26</guid>
		<description>&gt; Now â€” how bad would it be (from a performance standpoint) to move 0 into fp1 when you go
&gt; down that path for sending a message to nil, thus eliminating a class of bugs. And in the case of
&gt; struct returns, how bad would it be to fill the return struct with all 0â€™s in the case of sending to nil?

Moving 0 into fp1, to make float and double returns 0, would be very cheap.  And while you&#039;re at it, moving 0 into r4, to make long long returns 0, would be even cheaper.  But doing this with structs would probably require substantial runtime changes, since the objc_msgSend_stret() function doesn&#039;t know how big the struct return must be.

&gt; In my opinion, it would not result in any noticable performance penalty (Iâ€™m assuming that
&gt; messages passed to nil are the exception, not the rule), and could result in increased stability
&gt; of apps running on this platform.

I agree with you, and I&#039;ve asked this before.  The answer I was given was that Apple doesn&#039;t want to &quot;special case&quot; floats, doubles, and long longs since there&#039;s not a ready solution for the general case.

You can see &lt;a href=&quot;http://groups-beta.google.com/group/comp.lang.objective-c/browse_frm/thread/e7dd50ad0bfe6bb3/4ea095b232ff639e&quot; rel=&quot;nofollow&quot;&gt;the conversation I had on Usenet&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>&gt; Now â€” how bad would it be (from a performance standpoint) to move 0 into fp1 when you go<br />
&gt; down that path for sending a message to nil, thus eliminating a class of bugs. And in the case of<br />
&gt; struct returns, how bad would it be to fill the return struct with all 0â€™s in the case of sending to nil?</p>
<p>Moving 0 into fp1, to make float and double returns 0, would be very cheap.  And while you&#8217;re at it, moving 0 into r4, to make long long returns 0, would be even cheaper.  But doing this with structs would probably require substantial runtime changes, since the objc_msgSend_stret() function doesn&#8217;t know how big the struct return must be.</p>
<p>&gt; In my opinion, it would not result in any noticable performance penalty (Iâ€™m assuming that<br />
&gt; messages passed to nil are the exception, not the rule), and could result in increased stability<br />
&gt; of apps running on this platform.</p>
<p>I agree with you, and I&#8217;ve asked this before.  The answer I was given was that Apple doesn&#8217;t want to &#8220;special case&#8221; floats, doubles, and long longs since there&#8217;s not a ready solution for the general case.</p>
<p>You can see <a href="http://groups-beta.google.com/group/comp.lang.objective-c/browse_frm/thread/e7dd50ad0bfe6bb3/4ea095b232ff639e" rel="nofollow">the conversation I had on Usenet</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Ameline</title>
		<link>http://ridiculousfish.com/blog/archives/2005/05/29/nil/comment-page-1/#comment-25</link>
		<dc:creator>Ian Ameline</dc:creator>
		<pubDate>Wed, 01 Jun 2005 01:58:13 +0000</pubDate>
		<guid isPermaLink="false">http://ridiculousfish.com/blog/?p=14#comment-25</guid>
		<description>Awesome blog -- I&#039;ll definitely be following it.

I&#039;ve recently switched my primary development machine to be my mac, and It&#039;s so much nicer.

Now -- how bad would it be (from a performance standpoint) to move 0 into fp1 when you go down that path for sending a message to nil, thus eliminating a class of bugs. And in the case of struct returns, how bad would it be to fill the return struct with all 0&#039;s in the case of sending to nil?

In my opinion, it would not result in any noticable performance penalty (I&#039;m assuming that messages passed to nil are the exception, not the rule), and could result in increased stability of apps running on this platform.

What do you think?

Regards,
Ian Ameline,
Software Architect,
Alias Sketchbook Pro.</description>
		<content:encoded><![CDATA[<p>Awesome blog &#8212; I&#8217;ll definitely be following it.</p>
<p>I&#8217;ve recently switched my primary development machine to be my mac, and It&#8217;s so much nicer.</p>
<p>Now &#8212; how bad would it be (from a performance standpoint) to move 0 into fp1 when you go down that path for sending a message to nil, thus eliminating a class of bugs. And in the case of struct returns, how bad would it be to fill the return struct with all 0&#8217;s in the case of sending to nil?</p>
<p>In my opinion, it would not result in any noticable performance penalty (I&#8217;m assuming that messages passed to nil are the exception, not the rule), and could result in increased stability of apps running on this platform.</p>
<p>What do you think?</p>
<p>Regards,<br />
Ian Ameline,<br />
Software Architect,<br />
Alias Sketchbook Pro.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
