<?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 - Simplify Two Phase Constructor in Symbian - Comments</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html</link>
 <description>Comments for &quot;Simplify Two Phase Constructor in Symbian&quot;</description>
 <language>en</language>
<item>
 <title>Re: Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-46591</link>
 <description>&lt;p&gt;this information is enough to understand the 2phase construction.&lt;br /&gt;
thanks.&lt;/p&gt;</description>
 <pubDate>Wed, 28 May 2008 10:59:37 +0200</pubDate>
 <dc:creator>RaviRawat</dc:creator>
 <guid isPermaLink="false">comment 46591 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-39340</link>
 <description>&lt;p&gt;Something like...&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;#define declareNewLC(T) static T* NewLC()&lt;br /&gt;#define defineNewLC(T) T* T::NewLC() \&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {\&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; T* self = new (ELeave) T();\&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CleanupStack::PushL(self);\&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self-&amp;gt;ConstructL();\&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return self;\&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }\&lt;br /&gt;&lt;br /&gt;class CMyTest&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IMPORT_C declareNewLC(CMyTest);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CMyTest(){};&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void ConstructL(){};&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br /&gt;&lt;br /&gt;EXPORT_C defineNewLC(CMyTest);&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;</description>
 <pubDate>Wed, 20 Jun 2007 12:06:14 +0200</pubDate>
 <dc:creator>dennis_george</dc:creator>
 <guid isPermaLink="false">comment 39340 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-39339</link>
 <description>&lt;p&gt;You can simply make the constructor &quot;protected&quot;. &lt;/p&gt;

&lt;p&gt;But the provided solution will only be utilized for small subset of the problem. Because it cannot be used for&lt;br /&gt;
* Parametrized constructors.&lt;br /&gt;
* Exporting NewL and NewLC.&lt;br /&gt;
* These NewL functions are inlined. So will be slightly rigid in design (barrier for BC).&lt;/p&gt;

&lt;p&gt;So I think a slightly better solution would be to use macros. Instead of creating the template class.&lt;/p&gt;</description>
 <pubDate>Wed, 20 Jun 2007 12:02:18 +0200</pubDate>
 <dc:creator>dennis_george</dc:creator>
 <guid isPermaLink="false">comment 39339 at http://www.newlc.com</guid>
</item>
<item>
 <title>Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-2498</link>
 <description>&lt;div class=&quot;spip-content&quot;&gt;&lt;p class=&quot;spip&quot;&gt;This design forces the default constructor of the CUsePhase class to be public, which should be avoided as users should not be allowed to create objects of this class on stack. (&#039;C&#039; type classes).&lt;/p&gt;

&lt;p class=&quot;spip&quot;&gt;&lt;img class=&#039;spip_puce&#039; src=&#039;http://www.newlc.com/sites/all/themes/zen/images/blue_bullet.gif&#039; alt=&#039;-&#039; /&gt;&amp;nbsp;&amp;nbsp;Vink&lt;/p&gt;&lt;/div&gt;</description>
 <pubDate>Thu, 28 Dec 2006 11:17:25 +0100</pubDate>
 <dc:creator>vinay</dc:creator>
 <guid isPermaLink="false">comment 2498 at http://www.newlc.com</guid>
</item>
<item>
 <title>Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-2497</link>
 <description>&lt;div class=&quot;spip-content&quot;&gt;This design forces the default constructor of the CUsePhase class to be public, which should be avoided as users should not be allowed to create objects of this class on stack. (&#039;C&#039; type classes).&lt;/div&gt;</description>
 <pubDate>Fri, 22 Dec 2006 09:53:47 +0100</pubDate>
 <dc:creator>vinay</dc:creator>
 <guid isPermaLink="false">comment 2497 at http://www.newlc.com</guid>
</item>
<item>
 <title>Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-2501</link>
 <description>&lt;div class=&quot;spip-content&quot;&gt;Yeah, you would be &lt;i class=&quot;spip&quot;&gt;overloading&lt;/i&gt;.&lt;/div&gt;</description>
 <pubDate>Wed, 19 Jul 2006 17:10:33 +0200</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 2501 at http://www.newlc.com</guid>
</item>
<item>
 <title>Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-2500</link>
 <description>&lt;div class=&quot;spip-content&quot;&gt;&lt;p class=&quot;spip&quot;&gt;And to be perfectly accurate, applying delete to a null pointer is valid in C++ as described in the ISO/IEC standard. It results in a no-op.&lt;/p&gt;

&lt;p class=&quot;spip&quot;&gt;.f&lt;/p&gt;&lt;/div&gt;</description>
 <pubDate>Fri, 03 Mar 2006 18:24:16 +0100</pubDate>
 <dc:creator>[floyd]</dc:creator>
 <guid isPermaLink="false">comment 2500 at http://www.newlc.com</guid>
</item>
<item>
 <title>Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-2495</link>
 <description>&lt;div class=&quot;spip-content&quot;&gt;&lt;blockquote class=&quot;spip&quot;&gt;
&lt;p class=&quot;spip&quot;&gt;if you want parameterized constructors then you must override NewL and NewLC and then from that has to call NewL of CPhaseBase.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p class=&quot;spip&quot;&gt;This won&#039;t work if you have to initialise member references of your class, as they need to be passed in to the class&#039;s constructor.&lt;/p&gt;

&lt;p class=&quot;spip&quot;&gt;Also you wouldn&#039;t be &lt;i class=&quot;spip&quot;&gt;overriding&lt;/i&gt; NewL/NewLC from CPhaseBase as CPhaseBase functions take no parameters and therefore have different function signatures. And hey, they&#039;re not even virtual anyway.&lt;/p&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 20 Feb 2006 13:25:22 +0100</pubDate>
 <dc:creator>dDast</dc:creator>
 <guid isPermaLink="false">comment 2495 at http://www.newlc.com</guid>
</item>
<item>
 <title>Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-2499</link>
 <description>&lt;div class=&quot;spip-content&quot;&gt;&gt;&gt;&gt;&gt; 1) In C++ you are allowed to delete NULL. 
To be more particulare:
Not in C++. -----&gt;  In Symbian C++...:)&lt;/div&gt;</description>
 <pubDate>Thu, 16 Feb 2006 16:05:51 +0100</pubDate>
 <dc:creator>fwojtek</dc:creator>
 <guid isPermaLink="false">comment 2499 at http://www.newlc.com</guid>
</item>
<item>
 <title>Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-2494</link>
 <description>&lt;div class=&quot;spip-content&quot;&gt;&lt;p class=&quot;spip&quot;&gt;I want to comment a small detail in the code listing:
&lt;tt&gt;&lt;div align=&#039;left&#039; class=&#039;spip_code&#039; dir=&#039;ltr&#039;&gt;CUsePhase ::~CUsePhase()&lt;br /&gt;
{&lt;br /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(iMyBuf)&lt;br /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delete iMyBuf;&lt;br /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iMyBuf = NULL;&lt;br /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
}&lt;/div&gt;&lt;/tt&gt;&lt;/p&gt;

&lt;p class=&quot;spip&quot;&gt;There are two things which don&#039;t make sense. All you need there is a single row like this:
&lt;tt&gt;&lt;div align=&#039;left&#039; class=&#039;spip_code&#039; dir=&#039;ltr&#039;&gt;CUsePhase ::~CUsePhase()&lt;br /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;delete iMyBuf;&lt;br /&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;/tt&gt;&lt;/p&gt;

&lt;p class=&quot;spip&quot;&gt;...because:&lt;/p&gt;

&lt;p class=&quot;spip&quot;&gt;1) In C++ you are allowed to delete NULL. Members of C-based classes are always initialized to NULL during construction. You don&#039;t need the IF.&lt;/p&gt;

&lt;p class=&quot;spip&quot;&gt;2) There&#039;s no need to set the member to NULL after deletion in destructor.&lt;/p&gt;&lt;/div&gt;</description>
 <pubDate>Thu, 16 Feb 2006 14:27:04 +0100</pubDate>
 <dc:creator>pat</dc:creator>
 <guid isPermaLink="false">comment 2494 at http://www.newlc.com</guid>
</item>
<item>
 <title>Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-2493</link>
 <description>&lt;div class=&quot;spip-content&quot;&gt;&lt;p class=&quot;spip&quot;&gt;For every class that is derived from the class template, code for a new class type will be generated leading to increased executable size.&lt;/p&gt;

&lt;p class=&quot;spip&quot;&gt;Another way of reducing redundant code with out increasing the executable size is to use Macros for the function declarations and definitions.&lt;/p&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 13 Feb 2006 07:43:10 +0100</pubDate>
 <dc:creator>vijay_k_r</dc:creator>
 <guid isPermaLink="false">comment 2493 at http://www.newlc.com</guid>
</item>
<item>
 <title>Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comment-2492</link>
 <description>&lt;div class=&quot;spip-content&quot;&gt;Thanks for the valuable information. Using the trick does cuts down the development time .
 Girish&lt;/div&gt;</description>
 <pubDate>Mon, 13 Feb 2006 07:28:32 +0100</pubDate>
 <dc:creator>Girish</dc:creator>
 <guid isPermaLink="false">comment 2492 at http://www.newlc.com</guid>
</item>
<item>
 <title>Simplify Two Phase Constructor in Symbian</title>
 <link>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html</link>
 <description>&lt;div class=&quot;spip-content&quot;&gt;As we know that every time when we declare a class with initial C and derive from CBase we have to provide second phase constructor (NewL and NewLC ) in genral for such classes. There is a way which will give some flexibility to reduce to write NewL and NewLC evey time when you derive a class from CBase and need second phase constructor.&lt;/div&gt;&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.newlc.com/Simplify-Two-Phase-Constructor-in.html#comments</comments>
 <category domain="http://www.newlc.com/taxonomy/term/18">Tips</category>
 <pubDate>Fri, 10 Feb 2006 23:49:25 +0100</pubDate>
 <dc:creator>joshibhuvnesh</dc:creator>
 <guid isPermaLink="false">790 at http://www.newlc.com</guid>
</item>
</channel>
</rss>
