<?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/"
		>
<channel>
	<title>Comments on: You Should Avoid Partial Initialization of Objects</title>
	<atom:link href="http://codereflect.com/2007/02/28/you-should-avoid-partial-initialization-of-objects/feed/" rel="self" type="application/rss+xml" />
	<link>http://codereflect.com/2007/02/28/you-should-avoid-partial-initialization-of-objects/</link>
	<description>On Windows Programming, Technical Tips etc...</description>
	<lastBuildDate>Fri, 30 Jul 2010 00:48:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: cpon</title>
		<link>http://codereflect.com/2007/02/28/you-should-avoid-partial-initialization-of-objects/comment-page-1/#comment-2038</link>
		<dc:creator>cpon</dc:creator>
		<pubDate>Tue, 01 May 2007 15:09:04 +0000</pubDate>
		<guid isPermaLink="false">http://sarathc.wordpress.com/2007/02/28/you-should-avoid-partial-initialization-of-objects/#comment-2038</guid>
		<description>There is more information about why not throwing exception in constructors and destructors.  http://kal-el.ugr.es/~jmerelo/c++-faq/exceptions.html#faq-17.2</description>
		<content:encoded><![CDATA[<p>There is more information about why not throwing exception in constructors and destructors.  <a href="http://kal-el.ugr.es/~jmerelo/c++-faq/exceptions.html#faq-17.2" rel="nofollow">http://kal-el.ugr.es/~jmerelo/c++-faq/exceptions.html#faq-17.2</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: S a r a t h</title>
		<link>http://codereflect.com/2007/02/28/you-should-avoid-partial-initialization-of-objects/comment-page-1/#comment-2037</link>
		<dc:creator>S a r a t h</dc:creator>
		<pubDate>Thu, 01 Mar 2007 06:25:37 +0000</pubDate>
		<guid isPermaLink="false">http://sarathc.wordpress.com/2007/02/28/you-should-avoid-partial-initialization-of-objects/#comment-2037</guid>
		<description>Dear Dilip,
In Item 12(Copy all parts of an object ) of effective C++ 3rd Edition it is saying copy all part of an object in copy constructor or operator =. I think it is also applicatioble in the case of construction. i.e initialize all parts of an object. Sorry I was not creating new rules but I was posting an incident which can cause some unexpected behavior.
IMHO partial initialization of objects are not good. I reffered the name effective C++ because that many people may seem that this is an copied post. that&#039;s why I mentioned that name.

You are said about destructor is true but IMO, you should INTIIALIZE ALL PART OF AN OBJECT. I know the code I posted is a foolish one but still people making mistakes.</description>
		<content:encoded><![CDATA[<p>Dear Dilip,<br />
In Item 12(Copy all parts of an object ) of effective C++ 3rd Edition it is saying copy all part of an object in copy constructor or operator =. I think it is also applicatioble in the case of construction. i.e initialize all parts of an object. Sorry I was not creating new rules but I was posting an incident which can cause some unexpected behavior.<br />
IMHO partial initialization of objects are not good. I reffered the name effective C++ because that many people may seem that this is an copied post. that&#8217;s why I mentioned that name.</p>
<p>You are said about destructor is true but IMO, you should INTIIALIZE ALL PART OF AN OBJECT. I know the code I posted is a foolish one but still people making mistakes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dilip</title>
		<link>http://codereflect.com/2007/02/28/you-should-avoid-partial-initialization-of-objects/comment-page-1/#comment-2036</link>
		<dc:creator>Dilip</dc:creator>
		<pubDate>Thu, 01 Mar 2007 01:19:35 +0000</pubDate>
		<guid isPermaLink="false">http://sarathc.wordpress.com/2007/02/28/you-should-avoid-partial-initialization-of-objects/#comment-2036</guid>
		<description>You seem to be advocating some strange rules.  Throwing exception from a constructor is a well established way of informing the client code that the object construction did not take place due to some fatal error.  In fact it is the only way the caller can ever know if an object was constructed properly.

Now, whether allocated memory in ctors gets freed properly (before the exception is thrown) is another issue altogether.  That part is well covered by Scott Meyers in his More Effective C++.

The only agreeable point is you SHOULD NOT throw exceptions from a destructor because the dtor might be executing as a part of stack-unwind caused by another live exception.  The implementation will just call atexit or something like that and abort the application in such scenarios.</description>
		<content:encoded><![CDATA[<p>You seem to be advocating some strange rules.  Throwing exception from a constructor is a well established way of informing the client code that the object construction did not take place due to some fatal error.  In fact it is the only way the caller can ever know if an object was constructed properly.</p>
<p>Now, whether allocated memory in ctors gets freed properly (before the exception is thrown) is another issue altogether.  That part is well covered by Scott Meyers in his More Effective C++.</p>
<p>The only agreeable point is you SHOULD NOT throw exceptions from a destructor because the dtor might be executing as a part of stack-unwind caused by another live exception.  The implementation will just call atexit or something like that and abort the application in such scenarios.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
