Hi, I'm Paul, but you can also call me Todd and I won't get upset.
Paul.Todd | 02 April, 2007 23:18
jplauril | 06/06/2007, 16:50
Hi, I'm Paul, but you can also call me Todd and I won't get upset.
RDF Facets:
qfnZtopicQUqfnTopicZcppQ
qfnZtopicQUqfnTopicZseriesE5f60Q
qfnZtopicQUqfnTopicZseriesE5f80Q
qfnZtypeQUqfnTypeZBlogContentQ
qfnZtypeQUqfnTypeZBlogE45ntryQ
qfnZtypeQUqfnTypeZCommunityContentQ
qfnZtypeQUqfnTypeZWebpageQ
qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX
Re: Use and abuse of Symbian idioms
TwmD | 06/06/2007, 15:44
The general rule of R classes is that you should never "new" 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.
However, there are many exceptions to this rule in Symbian OS.
Here is where it gets confusing:
If you have RArray<TInt> a;
a.Append(12);
RArray<TInt> b= a;
a.Close()
RDebug::Print("%D",b[1]); <---- Does this work?
Is b still a valid copy? I.e was the RArray contents reference counted.
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.
Other classes which use R prefix are usually just proxy/pimpl objects.
Another one to watch out for is:
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.