<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.newlc.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>NewLC - Shouldn&amp;#039;t TPtr have a default constructor if it encapsulate a pointer? - Comments</title>
 <link>http://www.newlc.com/en/topic-10069</link>
 <description>Comments for &quot;Shouldn&#039;t TPtr have a default constructor if it encapsulate a pointer?&quot;</description>
 <language>en</language>
<item>
 <title>Re: Shouldn&#039;t TPtr have a default constructor if it encapsulate</title>
 <link>http://www.newlc.com/en/topic-10069#comment-24246</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Controls your use of the pointer -&amp;nbsp; it&amp;#039;s only meant to be used to deal with existing blocks of data.&lt;br /&gt;&lt;br /&gt;Consider TPtrC, it does have a default constructor, however this class only allows you to read data. TPtrC&amp;#039;s default constructor set&amp;#039;s it&amp;#039;s self to NULL, and length 0. So since your only use of a TPtrC will be read data, if you attempted to read some information from a TPtrC you&amp;#039;d end up with a descriptor of NULL content and zero length. - This makes sense.&lt;br /&gt;&lt;br /&gt;Now consider TPtr, it&amp;#039;s mean to be used for looking at, and modifying data... if it had a default constructor what would it set it&amp;#039;s self too ? NULL and 0 length ? - Ok, but now what happens when you try to write to this descriptor.... you&amp;#039;d get a memory exception, and your app would panic and die - probably with an unhandled exception.&lt;br /&gt;&lt;br /&gt;To prevent this, TPtr does not have a default constructor, so you have to set it to something before you can use it.&lt;/div&gt;</description>
 <pubDate>Thu, 25 Aug 2005 19:29:08 +0200</pubDate>
 <dc:creator>mc_woods</dc:creator>
 <guid isPermaLink="false">comment 24246 at http://www.newlc.com</guid>
</item>
<item>
 <title>Shouldn&#039;t TPtr have a default constructor if it encapsulate a pointer?</title>
 <link>http://www.newlc.com/en/topic-10069</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/en/topic-10069&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.newlc.com/en/topic-10069#comments</comments>
 <category domain="http://www.newlc.com/en/forums/symbian-c">Symbian C++</category>
 <pubDate>Thu, 25 Aug 2005 19:09:43 +0200</pubDate>
 <dc:creator>nikolas</dc:creator>
 <guid isPermaLink="false">10487 at http://www.newlc.com</guid>
</item>
</channel>
</rss>
