<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en"> 
    <title>Paul Todd's Forum Nokia Blog - Use and abuse of Symbian idioms</title>  
                    <updated>2007-06-06T16:50:20Z</updated>
    <id>http://blogs.forum.nokia.com,8.9/</id>
    <link rel="alternate" type="text/html" hreflang="en" href="http://blogs.forum.nokia.com/blog/paul-todds-forum-nokia-blog/2007/04/02/use-and-abuse-of-symbian-idioms" />
    <rights>Copyright (c) 2008 Nokia</rights> 
    <generator uri="http://www.lifetype.net/" version="1.2">LifeType</generator> 

                                    <entry>
            <title></title>
            <link rel="alternate" type="text/html" href="http://blogs.forum.nokia.com/blog/paul-todds-forum-nokia-blog/2007/04/02/use-and-abuse-of-symbian-idioms#comment1351" />
            <id>tag:blogs.forum.nokia.com,2007-06-06:1351</id>
                        <updated>2007-06-06T16:50:20Z</updated>
            <published>2007-06-06T16:50:20Z</published>
            <summary type="html">/me raises hand.  I fixed a bug like this from my code just five minutes ago :)</summary>
            <author>
                <name>jplauril</name>
                <uri>http://blogs.forum.nokia.com/blog/paul-todds-forum-nokia-blog</uri>
            </author>
            <content type="text/html" xml:lang="en" xml:base="http://blogs.forum.nokia.com/blog/paul-todds-forum-nokia-blog">
                /me raises hand.&lt;br /&gt;&lt;br /&gt;I fixed a bug like this from my code just five minutes ago :)
            </content>
        </entry>
                                    <entry>
            <title></title>
            <link rel="alternate" type="text/html" href="http://blogs.forum.nokia.com/blog/paul-todds-forum-nokia-blog/2007/04/02/use-and-abuse-of-symbian-idioms#comment1350" />
            <id>tag:blogs.forum.nokia.com,2007-06-06:1350</id>
                        <updated>2007-06-06T15:44:44Z</updated>
            <published>2007-06-06T15:44:44Z</published>
            <summary type="html">RClasses as an idiom work quite well for real resources or references to objects owned by other threads. But are pretty confusing when used as datastructures.  The general rule of R classes is ...</summary>
            <author>
                <name>TwmD</name>
                <uri>http://blogs.forum.nokia.com/blog/paul-todds-forum-nokia-blog</uri>
            </author>
            <content type="text/html" xml:lang="en" xml:base="http://blogs.forum.nokia.com/blog/paul-todds-forum-nokia-blog">
                RClasses as an idiom work quite well for real resources or references to objects owned by other threads. But are pretty confusing when used as datastructures.&lt;br /&gt;&lt;br /&gt;The general rule of R classes is that you should never &amp;quot;new&amp;quot; them since it should be possible to copy R classes by value. As an example and RString is a handle to a real string owned by an RStringPool object - so copying the RString would mean copying just the handle and not the whole string.&lt;br /&gt;However, there are many exceptions to this rule in Symbian OS.&lt;br /&gt;&lt;br /&gt;Here is where it gets confusing:&lt;br /&gt;&lt;br /&gt;If you have RArray&amp;lt;TInt&amp;gt; a;&lt;br /&gt;a.Append(12);&lt;br /&gt;RArray&amp;lt;TInt&amp;gt; b= a;&lt;br /&gt;a.Close()&lt;br /&gt;RDebug::Print(&amp;quot;%D&amp;quot;,b[1]); &amp;lt;---- Does this work?&lt;br /&gt;&lt;br /&gt;Is b still a valid copy? I.e was the RArray contents reference counted.&lt;br /&gt;&lt;br /&gt;In my view Symbian should have used R classes only for things which derive from RHandleBase and have a clear policy for duplication and sharing accross threads and processes.&lt;br /&gt;Other classes which use R prefix are usually just proxy/pimpl objects.&lt;br /&gt;&lt;br /&gt;Another one to watch out for is:&lt;br /&gt;RPointerArray - You must call ResetAndDestroy() before the call to Close() if you want all the objects delete. Close() only deletes the memory allocated to the container.
            </content>
        </entry>
    </feed>