<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"	>
<channel>
	<title>Comments on: Use of the pure attribute for GObject convenience getters</title>
	<atom:link href="http://tecnocode.co.uk/2010/04/02/use-of-the-pure-attribute-for-gobject-convenience-getters/feed/" rel="self" type="application/rss+xml" />
	<link>http://tecnocode.co.uk/2010/04/02/use-of-the-pure-attribute-for-gobject-convenience-getters/</link>
	<description>Ramblings on computers…</description>
	<lastBuildDate>Fri, 20 Jan 2012 21:19:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Philip Withnall</title>
		<link>http://tecnocode.co.uk/2010/04/02/use-of-the-pure-attribute-for-gobject-convenience-getters/comment-page-1/#comment-864</link>
		<dc:creator>Philip Withnall</dc:creator>
		<pubDate>Sat, 03 Apr 2010 23:40:09 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=328#comment-864</guid>
		<description>That&#039;s my conclusion, yes. Of course, objects using pure getters could still be used in a multi-threaded app, as long as all changes to them were marshalled through the main thread.</description>
		<content:encoded><![CDATA[<p>That's my conclusion, yes. Of course, objects using pure getters could still be used in a multi-threaded app, as long as all changes to them were marshalled through the main thread.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fscan</title>
		<link>http://tecnocode.co.uk/2010/04/02/use-of-the-pure-attribute-for-gobject-convenience-getters/comment-page-1/#comment-859</link>
		<dc:creator>fscan</dc:creator>
		<pubDate>Sat, 03 Apr 2010 21:35:58 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=328#comment-859</guid>
		<description>this only works if my_object_get_property_foo() is only called from frobnicate() (or you have to somehow guarantee that it is called between locks, assuming my_object_set_property_foo() locks too). locking outside of my_object would not work, because there is nothing to tell the compiler the value could have changed.

so, the only _save_ use is the single threaded case (modified and read from 1 thread)...</description>
		<content:encoded><![CDATA[<p>this only works if my_object_get_property_foo() is only called from frobnicate() (or you have to somehow guarantee that it is called between locks, assuming my_object_set_property_foo() locks too). locking outside of my_object would not work, because there is nothing to tell the compiler the value could have changed.</p>
<p>so, the only _save_ use is the single threaded case (modified and read from 1 thread)...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip Withnall</title>
		<link>http://tecnocode.co.uk/2010/04/02/use-of-the-pure-attribute-for-gobject-convenience-getters/comment-page-1/#comment-853</link>
		<dc:creator>Philip Withnall</dc:creator>
		<pubDate>Sat, 03 Apr 2010 20:53:28 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=328#comment-853</guid>
		<description>In my example, the my_object_get_property_foo() would be the pure one, while frobnicate() (which is calling it) has the locking. I expect that would be the normal solution, since there&#039;d be a potential race in frobnicate() otherwise.

You are correct though: functions with locking can never be pure, because the locks use volatile memory.

My argument is that pure could be used for all trivial getters of an object, under the assumption that the object is only modified from one thread.</description>
		<content:encoded><![CDATA[<p>In my example, the my_object_get_property_foo() would be the pure one, while frobnicate() (which is calling it) has the locking. I expect that would be the normal solution, since there'd be a potential race in frobnicate() otherwise.</p>
<p>You are correct though: functions with locking can never be pure, because the locks use volatile memory.</p>
<p>My argument is that pure could be used for all trivial getters of an object, under the assumption that the object is only modified from one thread.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fscan</title>
		<link>http://tecnocode.co.uk/2010/04/02/use-of-the-pure-attribute-for-gobject-convenience-getters/comment-page-1/#comment-843</link>
		<dc:creator>fscan</dc:creator>
		<pubDate>Sat, 03 Apr 2010 15:49:56 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=328#comment-843</guid>
		<description>as i understand it, methods with locking can never be __pure__, because a lock is a system resource. and how should the compiler know at compile time if an other thread has changed the value, even with locking?
the only methods i can think of using pure are getters for variables that do not change or methods that do not access object members.</description>
		<content:encoded><![CDATA[<p>as i understand it, methods with locking can never be __pure__, because a lock is a system resource. and how should the compiler know at compile time if an other thread has changed the value, even with locking?<br />
the only methods i can think of using pure are getters for variables that do not change or methods that do not access object members.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip Withnall</title>
		<link>http://tecnocode.co.uk/2010/04/02/use-of-the-pure-attribute-for-gobject-convenience-getters/comment-page-1/#comment-809</link>
		<dc:creator>Philip Withnall</dc:creator>
		<pubDate>Sat, 03 Apr 2010 07:40:05 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=328#comment-809</guid>
		<description>There are more situations than that which could be optimised, but you&#039;re right that it probably wouldn&#039;t give many gains. Still, it&#039;s only 12 characters per function.</description>
		<content:encoded><![CDATA[<p>There are more situations than that which could be optimised, but you're right that it probably wouldn't give many gains. Still, it's only 12 characters per function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: db</title>
		<link>http://tecnocode.co.uk/2010/04/02/use-of-the-pure-attribute-for-gobject-convenience-getters/comment-page-1/#comment-790</link>
		<dc:creator>db</dc:creator>
		<pubDate>Sat, 03 Apr 2010 02:59:09 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=328#comment-790</guid>
		<description>Declaring these functions pure only saves if two calls to the function occur in succession (or if the return value isn&#039;t used -- but why call &quot;get&quot; then?) -- so the gain is extremely marginal.  not worth the typing.</description>
		<content:encoded><![CDATA[<p>Declaring these functions pure only saves if two calls to the function occur in succession (or if the return value isn't used -- but why call "get" then?) -- so the gain is extremely marginal.  not worth the typing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip Withnall</title>
		<link>http://tecnocode.co.uk/2010/04/02/use-of-the-pure-attribute-for-gobject-convenience-getters/comment-page-1/#comment-781</link>
		<dc:creator>Philip Withnall</dc:creator>
		<pubDate>Fri, 02 Apr 2010 22:52:40 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=328#comment-781</guid>
		<description>Yeah; I just merged the declaration into the definition in the example to make it shorter. I think I&#039;ll split them up, since it isn&#039;t clear enough this way.</description>
		<content:encoded><![CDATA[<p>Yeah; I just merged the declaration into the definition in the example to make it shorter. I think I'll split them up, since it isn't clear enough this way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://tecnocode.co.uk/2010/04/02/use-of-the-pure-attribute-for-gobject-convenience-getters/comment-page-1/#comment-780</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Fri, 02 Apr 2010 22:30:29 +0000</pubDate>
		<guid isPermaLink="false">http://tecnocode.co.uk/?p=328#comment-780</guid>
		<description>I take it the header is where the attribute needs to be applied so that calling/linking code can be optimized appropriately?</description>
		<content:encoded><![CDATA[<p>I take it the header is where the attribute needs to be applied so that calling/linking code can be optimized appropriately?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.379 seconds -->

