<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>my not-so technical blog</title>
	<atom:link href="http://lookdit.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://lookdit.wordpress.com</link>
	<description>when sharing is not enough....</description>
	<lastBuildDate>Sat, 12 Feb 2011 16:07:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='lookdit.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>my not-so technical blog</title>
		<link>http://lookdit.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://lookdit.wordpress.com/osd.xml" title="my not-so technical blog" />
	<atom:link rel='hub' href='http://lookdit.wordpress.com/?pushpress=hub'/>
		<item>
		<title>WTL::CString and ATL::CString</title>
		<link>http://lookdit.wordpress.com/2010/09/18/wtlcstring-and-atlcstring/</link>
		<comments>http://lookdit.wordpress.com/2010/09/18/wtlcstring-and-atlcstring/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 07:15:04 +0000</pubDate>
		<dc:creator>nerwin hernando</dc:creator>
		
		<guid isPermaLink="false">http://lookdit.wordpress.com/?p=296</guid>
		<description><![CDATA[When you want to use one of this refer to http://www.codewiz51.com/blog/post/2009/01/23/Using-WTL-in-an-ATL-Attributed-Component.aspx This article discusses both types.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=296&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When you want to use one of this refer to http://www.codewiz51.com/blog/post/2009/01/23/Using-WTL-in-an-ATL-Attributed-Component.aspx<br />
This article discusses both types.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lookdit.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lookdit.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lookdit.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lookdit.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lookdit.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lookdit.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lookdit.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lookdit.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lookdit.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lookdit.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lookdit.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lookdit.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lookdit.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lookdit.wordpress.com/296/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=296&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lookdit.wordpress.com/2010/09/18/wtlcstring-and-atlcstring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c7af6cb775f23abf74e9696dc57af8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nerwinc0hernando</media:title>
		</media:content>
	</item>
		<item>
		<title>atlsmtpconnection.h removed in Visual Studio 2008 and higher version</title>
		<link>http://lookdit.wordpress.com/2010/09/13/atlsmtpconnection-h-removed-in-visual-studio-2008-and-higher-version/</link>
		<comments>http://lookdit.wordpress.com/2010/09/13/atlsmtpconnection-h-removed-in-visual-studio-2008-and-higher-version/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 07:22:38 +0000</pubDate>
		<dc:creator>nerwin hernando</dc:creator>
		
		<guid isPermaLink="false">http://lookdit.wordpress.com/?p=294</guid>
		<description><![CDATA[Damn it. Why do they removed some header files from the previous version.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=294&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Damn it. Why do they removed some header files from the previous version.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lookdit.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lookdit.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lookdit.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lookdit.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lookdit.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lookdit.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lookdit.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lookdit.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lookdit.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lookdit.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lookdit.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lookdit.wordpress.com/294/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lookdit.wordpress.com/294/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lookdit.wordpress.com/294/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=294&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lookdit.wordpress.com/2010/09/13/atlsmtpconnection-h-removed-in-visual-studio-2008-and-higher-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c7af6cb775f23abf74e9696dc57af8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nerwinc0hernando</media:title>
		</media:content>
	</item>
		<item>
		<title>Installing SQL Server 2005 on Windows 7</title>
		<link>http://lookdit.wordpress.com/2010/09/12/installing-sql-server-2005-on-windows-7/</link>
		<comments>http://lookdit.wordpress.com/2010/09/12/installing-sql-server-2005-on-windows-7/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 14:40:21 +0000</pubDate>
		<dc:creator>nerwin hernando</dc:creator>
				<category><![CDATA[Configurations]]></category>

		<guid isPermaLink="false">http://lookdit.wordpress.com/?p=276</guid>
		<description><![CDATA[Reason: I encountered the following errors: &#8220;Microsoft Internet Information Services (IIS) is either not installed or is disabled. IIS is required by some SQL Server features. Without IIS, some SQL Server features will not be available for installation. To install all SQL Server features, install IIS from Add or Remove Programs in Control Panel or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=276&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_278" class="wp-caption alignleft" style="width: 507px"><a href="http://lookdit.files.wordpress.com/2010/09/err_iis1.jpg"><img src="http://lookdit.files.wordpress.com/2010/09/err_iis1.jpg?w=497&#038;h=449" alt="" title="ISS Feature Requirement" width="497" height="449" class="size-full wp-image-278" /></a><p class="wp-caption-text">warning message</p></div>Reason: I encountered the following errors:</p>
<p>&#8220;Microsoft Internet Information Services (IIS) is either not installed or is disabled. IIS is required by some SQL Server features. Without IIS, some SQL Server features will not be available for installation. To install all SQL Server features, install IIS from Add or Remove Programs in Control Panel or enable the IIS service through the Control Panel if it is already installed, and then run SQL Server Setup again. For a list of features that depend on IIS, see Features Supported by Editions of SQL Server in &#8230;&#8221;</p>
<p>Solution:<br />
Refer to the following sites:</p>
<p>http://support.microsoft.com/kb/920201</p>
<p>http://learn.iis.net/page.aspx/28/installing-iis-7-on-windows-vista-and-windows-7/</p>
<p>Download the latest service pack of Sql Server 2005.</p>
<p>http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ae7387c3-348c-4faa-8ae5-949fdfbe59c4&#038;displaylang=en</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lookdit.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lookdit.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lookdit.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lookdit.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lookdit.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lookdit.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lookdit.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lookdit.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lookdit.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lookdit.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lookdit.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lookdit.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lookdit.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lookdit.wordpress.com/276/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=276&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lookdit.wordpress.com/2010/09/12/installing-sql-server-2005-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c7af6cb775f23abf74e9696dc57af8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nerwinc0hernando</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/09/err_iis1.jpg" medium="image">
			<media:title type="html">ISS Feature Requirement</media:title>
		</media:content>
	</item>
		<item>
		<title>Restore file association of JScript files in ATL/WTL ~\WTL80\AppWiz</title>
		<link>http://lookdit.wordpress.com/2010/07/29/restore-file-association-of-setup-file-in-atlwtl-jscript-file/</link>
		<comments>http://lookdit.wordpress.com/2010/07/29/restore-file-association-of-setup-file-in-atlwtl-jscript-file/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 16:25:46 +0000</pubDate>
		<dc:creator>nerwin hernando</dc:creator>
				<category><![CDATA[Configurations]]></category>

		<guid isPermaLink="false">http://lookdit.wordpress.com/?p=273</guid>
		<description><![CDATA[In case you encounter an error in running the setup files for installing the atl/wtl wizard &#8220;There is no script engine for file extension &#8220;.js&#8221;.&#8221;, you can refer to this site. http://www.winhelponline.com/articles/230/1/Error-There-is-no-script-engine-for-file-extension-when-running-js-files.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=273&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In case you encounter an error in running the setup files for installing the atl/wtl wizard &#8220;There is no script engine for file extension &#8220;.js&#8221;.&#8221;, you can refer to this site.</p>
<p>http://www.winhelponline.com/articles/230/1/Error-There-is-no-script-engine-for-file-extension-when-running-js-files.html</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lookdit.wordpress.com/273/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lookdit.wordpress.com/273/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lookdit.wordpress.com/273/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lookdit.wordpress.com/273/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lookdit.wordpress.com/273/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lookdit.wordpress.com/273/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lookdit.wordpress.com/273/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lookdit.wordpress.com/273/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lookdit.wordpress.com/273/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lookdit.wordpress.com/273/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lookdit.wordpress.com/273/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lookdit.wordpress.com/273/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lookdit.wordpress.com/273/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lookdit.wordpress.com/273/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=273&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lookdit.wordpress.com/2010/07/29/restore-file-association-of-setup-file-in-atlwtl-jscript-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c7af6cb775f23abf74e9696dc57af8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nerwinc0hernando</media:title>
		</media:content>
	</item>
		<item>
		<title>C++ Links</title>
		<link>http://lookdit.wordpress.com/2010/07/27/c-links/</link>
		<comments>http://lookdit.wordpress.com/2010/07/27/c-links/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 02:49:47 +0000</pubDate>
		<dc:creator>nerwin hernando</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://lookdit.wordpress.com/?p=262</guid>
		<description><![CDATA[1. http://anteru.net/2009/03/14/385/ &#8211; Private Implementation (PIMPL) 2. http://blog.emptycrate.com/node/277 &#8211; BOOST 3. http://www2.research.att.com/~bs/bs_faq2.html &#8211; Bjarne<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=262&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>1. http://anteru.net/2009/03/14/385/ &#8211; Private Implementation (PIMPL)<br />
2. http://blog.emptycrate.com/node/277 &#8211; BOOST<br />
3. http://www2.research.att.com/~bs/bs_faq2.html &#8211; Bjarne</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lookdit.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lookdit.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lookdit.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lookdit.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lookdit.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lookdit.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lookdit.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lookdit.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lookdit.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lookdit.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lookdit.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lookdit.wordpress.com/262/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lookdit.wordpress.com/262/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lookdit.wordpress.com/262/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=262&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lookdit.wordpress.com/2010/07/27/c-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c7af6cb775f23abf74e9696dc57af8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nerwinc0hernando</media:title>
		</media:content>
	</item>
		<item>
		<title>C++ Books Recommended</title>
		<link>http://lookdit.wordpress.com/2010/07/15/c-books-i-basa-and-to-basa-then-limot-intentionally/</link>
		<comments>http://lookdit.wordpress.com/2010/07/15/c-books-i-basa-and-to-basa-then-limot-intentionally/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 09:58:57 +0000</pubDate>
		<dc:creator>nerwin hernando</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://lookdit.wordpress.com/?p=250</guid>
		<description><![CDATA[1. C++ Coding Standards, Herb Stutter, Andrei Alexandrescu 2. C++ Standard Library, Nikolai Josuttis 3. C++ Modern Designs, Andrei Alexandrescu<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=250&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>1. C++ Coding Standards, Herb Stutter, Andrei Alexandrescu<br />
2. C++ Standard Library, Nikolai Josuttis<br />
3. C++ Modern Designs, Andrei Alexandrescu</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lookdit.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lookdit.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lookdit.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lookdit.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lookdit.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lookdit.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lookdit.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lookdit.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lookdit.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lookdit.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lookdit.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lookdit.wordpress.com/250/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lookdit.wordpress.com/250/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lookdit.wordpress.com/250/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=250&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lookdit.wordpress.com/2010/07/15/c-books-i-basa-and-to-basa-then-limot-intentionally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c7af6cb775f23abf74e9696dc57af8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nerwinc0hernando</media:title>
		</media:content>
	</item>
		<item>
		<title>Vocabulary</title>
		<link>http://lookdit.wordpress.com/2010/07/11/unfamiliar-words/</link>
		<comments>http://lookdit.wordpress.com/2010/07/11/unfamiliar-words/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 17:47:16 +0000</pubDate>
		<dc:creator>nerwin hernando</dc:creator>
				<category><![CDATA[Non-Technical]]></category>

		<guid isPermaLink="false">http://lookdit.wordpress.com/?p=244</guid>
		<description><![CDATA[I always tend to forget words, so I decided to place a list in here. July 2010 1. impervious 2. solidus, reverse solidus 3. dichotomy<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=244&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I always tend to forget words, so I decided to place a list in here.</p>
<p>July 2010<br />
1. impervious<br />
2. solidus, reverse solidus<br />
3. dichotomy</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lookdit.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lookdit.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lookdit.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lookdit.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lookdit.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lookdit.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lookdit.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lookdit.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lookdit.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lookdit.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lookdit.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lookdit.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lookdit.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lookdit.wordpress.com/244/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=244&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lookdit.wordpress.com/2010/07/11/unfamiliar-words/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c7af6cb775f23abf74e9696dc57af8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nerwinc0hernando</media:title>
		</media:content>
	</item>
		<item>
		<title>C++ Common Knowledge by Stephen C. Dewherst</title>
		<link>http://lookdit.wordpress.com/2010/05/27/c-common-knowledge-by-stephen-c-dewherst/</link>
		<comments>http://lookdit.wordpress.com/2010/05/27/c-common-knowledge-by-stephen-c-dewherst/#comments</comments>
		<pubDate>Thu, 27 May 2010 09:07:35 +0000</pubDate>
		<dc:creator>nerwin hernando</dc:creator>
				<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://lookdit.wordpress.com/?p=178</guid>
		<description><![CDATA[I want to share some information from the book of Stephen C. Dewherst about his book.. He discusses C++ Common Knowledge. Enjoy! Item 1 &#8211; Data Abstraction Type &#8211; a set of operations Abstract Data Type &#8211; set of operations with an implementation * What can I do with this object, not how is this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=178&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I want to share some information from the book of Stephen C. Dewherst about his book.. He discusses C++ Common Knowledge.<br />
Enjoy!</p>
<p><strong>Item 1 &#8211; Data Abstraction</strong><br />
Type &#8211; a set of operations<br />
Abstract Data Type &#8211; set of operations with an implementation<br />
 * What can I do with this object, not how is this object implemented.<br />
The purpose of ADT is to extend the Programming language into a particular problem domain<br />
ADT will change much more frequently than their interfaces.</p>
<p>Approaches in designing ADT<br />
1. Choose a descriptive name for the type.<br />
2. List the operations that the type can perform.<br />
3. Design an interface for the type. (easy to use and hard to use incorrectly)<br />
4. Implement the type.</p>
<p><strong>Item 2 &#8211; Polymorphism</strong><br />
According to standard,<br />
     &#8211; &#8220;a polymorphic type&#8221; is a class type that has virtual function.<br />
     &#8211; &#8220;a polymorphic object&#8221; is an object with more than one type<br />
     &#8211; &#8220;a polymorphic base class&#8221; is a base class that is designed for use by P.O.<br />
<code><br />
              ---------------<br />
             |    Option       |<br />
              ---------------<br />
             |    price()       |<br />
             |    update()    |<br />
             ----------------<br />
            /                 \<br />
           /                   \<br />
-------------         -----------------<br />
| AmOption   |       | EuroOption       |<br />
-------------        ------------------</p>
<p>AmOption *d = new AmOption;<br />
Option *b = d;<br />
d-&gt;price();  // if this calls AmOption::price..<br />
b-&gt;price(); // so should this</code></p>
<p><strong>Item 3 &#8211; Design Patterns</strong><br />
- are an essential component of the professional C++ programmer&#8217;s toolkit.<br />
- recurring architectural pattern<br />
- programmer to programmer communication<br />
- patterns wonks sometimes describes DP as a form of literature that follows a certain formal structure.<br />
- often described as &#8220;micro architectures&#8221;</p>
<p>Design Pattern&#8217;s Formal Structure<br />
1) Patterns must have an unambiguous name.<br />
2) Pattern descriptions must define the problem addressed by the pattern.<br />
3) The PD describes the problem&#8217;s solution.<br />
4) The PD describes the consequences of applying the pattern to the context.</p>
<p><strong>Item 4 &#8211; The Standard Template Library</strong><br />
- the STL isn&#8217;t a library. It&#8217;s an inspired idea and a set of conventions.<br />
- an STL algorithm is an abstraction of a function, implemented as a  function template<br />
- an STL container is an abstraction of a data structure, implemented as a class template<br />
- an iterator is like a pointer, the first iterator refers to the first element of the sequence while the second iterator refers to one past the last element of the sequence, (not the last element). if both iterators refer to the same element, they define an empty sequence.<br />
- clearer and more maintainable code<br />
- Learn the STL and use it extensively</p>
<p>3 Major Kinds of Components<br />
1) Containers &#8211; contain and organize elements<br />
2) Algorithms &#8211; performs operations<br />
3) Iterators &#8211; for accesing elements</p>
<p><strong>Item 5 &#8211; References Are Aliases, Not Pointers</strong><br />
- A reference is another name for an existing object<br />
- references are often confused to pointers</p>
<p><code>int a = 12;<br />
int &amp;ra = a; // ra is another name for a<br />
--ra; // a == 11<br />
a = 10;  // ra == 10<br />
int *ip = &amp;ra; // ip points to a<br />
</code></p>
<p>3 Major Differences between References and Pointers<br />
1) There are no null reference,<br />
2) all references require initialization<br />
3) A reference always refer to the object with which it is initialized.</p>
<p><strong>Item 6 &#8211; Array Formal Arguments</strong><br />
- problematic because there are no array formal arguments because array is passed as a pointer to its first element<br />
- decay, an array decays to a pointer of its first element</p>
<p>void average( int ary[12] );  // formal arg is int*</p>
<p>int anArray[] = {1, 2, 3 }; // three element array<br />
const in anArraySize = sizeof(anArrary)/sizeof(anArray[0]); // == 3<br />
average(anArray); // legal</p>
<p>void average(int ary[]); // formal arg is still int*<br />
void average(int (&amp;ary)[12]); // precise value<br />
- will only accept an array with size 12<br />
//&#8230;<br />
- templates help to generalize somewhat</p>
<p>template<br />
void average(int (&amp;ary)[n]); // let compiler deduce n for us</p>
<p>- traditional<br />
void average_n(int ary[], int size);</p>
<p>- or can be combined<br />
template<br />
inline void average(int (&amp;ary)[n])<br />
{ average_n(ary,n);}</p>
<p>int *anArray2 = new int[anArraySize];<br />
average(anArray2); // error! can&#8217;t init int(&amp;)[n] with int*<br />
average_n( anArray, anArraySize ); // OK&#8230;</p>
<p>- multidimensioal array formal arguments are not essentially different but more challenging.</p>
<p>Single &#8211; Pointer to the array&#8217;s first element<br />
Multi &#8211; Pointer to an array</p>
<p>void process( int (*ary)[20] ); // ptr to array of 20 ints<br />
void process( int ary[][20] ); // same but clearer</p>
<p>void  process_2d( int *a, int n, int m ) { // a is an n by m array<br />
    for( int i = 0; i &lt; n; ++i )<br />
        for( int j = 0; j &lt; m; ++j )<br />
            a[i*m+j] = 0; // calculate index by hand<br />
}</p>
<p>// use template to make things cleaner</p>
<p>template<br />
inline void process( int (&amp;ary)[n][m] )<br />
{ process_2d( &amp;ary[0][0], n, m);}</p>
<p><strong>Item 7 &#8211; Const Pointers and Pointers to Const</strong><br />
T *pt = new T; // ptr to T<br />
const T *pct = pt; // ptr to const T<br />
T *const cpt = pt;  // const ptr to T</p>
<p>const T *p1; // ptr to const T, traditioal<br />
T const *p2; // same</p>
<p>* Common Error *<br />
T const *p3; // ptr to const<br />
T *const p4 = pt; // const ptr to non-const</p>
<p>const T *const cpct1 = pt; // everything is const<br />
T const *const cpct2 = cpct1; // same</p>
<p>It is often simpler to use a reference in preference to a const pointer.</p>
<p>const T &amp;rct = *pt; // rather than const T *const<br />
T &amp;rt = *pt; // rather than T *const</p>
<p><strong>Item 8 &#8211; Pointers to Pointers</strong><br />
- &#8220;multilevel&#8221; pointer</p>
<p>int *pi;   // a ptr<br />
int **ppi; // two level multilevel ptr<br />
int ***pppi; // a three level multilevel ptr</p>
<p>Shape *picture[MAX];<br />
Shape **pic1 = picture;</p>
<p>// moves a pointer to refer to the next occurence of a character in a string:<br />
// p &#8211; the value we want to change<br />
void scanTo( const char **p, char c ) {<br />
    while( **p &amp;&amp; **p != c )<br />
        ++*p;<br />
}</p>
<p>char s[] = &#8220;Hello, World!&#8221;;<br />
const char *cp = s;<br />
scanTo(&amp;cp, &#8216;,&#8217;); // move cp to first comma</p>
<p>- safer process<br />
void scanTo( const char *&amp;p, char c ) {<br />
    while( *p &amp;&amp; *p != c )<br />
        ++p;<br />
}</p>
<p>char s[] = &#8220;Hello, World!&#8221;;<br />
const char *cp = s;<br />
scanTo(cp, &#8216;,&#8217;); // move cp to first comma</p>
<p>* Common Misconception *<br />
- conversion that apply pointers also apply to p<br />
pointers to pointers</p>
<p>Circle *c = new Circle;<br />
Shape *s = c; // fine</p>
<p>Circle **cc = &amp;c;<br />
Shape **ss = cc; // error</p>
<p>char *s1 = 0;<br />
const char *s2 = s1; // OK<br />
char *a[MAX]; // aka char **<br />
const char **ps = a; // err</p>
<p><strong>Item 9 &#8211; New Cast Operators</strong><br />
- old style casts can do terrible damage unnoticeably</p>
<p>char *hopeItWorks =  (char*) 0x00ff0000; // old-style cast</p>
<p>typedef char *PChar;<br />
hopeItWorks =  PChar( 0x00ff0000 ); // function style/old style cast stll</p>
<p>New Cast Operators (4)<br />
1) const_cast<br />
    &#8211; alllows you to add/remove const and volatile type qualifier</p>
<p>    const Person *getEmployee() {&#8230;}<br />
    // &#8230;<br />
    Person *anEmployee =     const_cast(getEmployee());<br />
2) static_cast<br />
    &#8211; used for castings that are relatively portable across platforms<br />
    &#8211; commonly used to cast &#8220;down&#8221; an inheritance hierarchy from Base class pointer or reference toward a derived class.</p>
<p>    Shape *sp = new Circle;<br />
    Circle *cp = static_cast( sp) ; // downcast</p>
<p>    const Shape *getNextShape() { &#8230; }<br />
    //&#8230;<br />
    Circle *cp = static_cast(const_cast(getNextShape()));</p>
<p>3. reinterpret_cast<br />
    &#8211; often necessary in low level code but it is not likely portable.<br />
    &#8211; will typically just pretend the base class pointer is a derived class pointer while a static cast will perform the correct<br />
      address manipulation<br />
    hopeItWorks = // pretend int is a pointer<br />
        reinterpret_cast(0x00ff0000);<br />
    int *hopeless = // pretend char* is int *<br />
        reinterpret_cast(hopeItWorks);<br />
4. dynamic_cast<br />
    &#8211; used typically to perform a safe down cast from a pointer to a based to a derived class.</p>
<p>    const Circle *cp = dynamic_cast(getNextShape());<br />
    if( cp ) { &#8230; }</p>
<p>    if(const Circle *cp = dynamic_cast(getNextShape())) { &#8230; }</p>
<p><strong>Item 10 &#8211; Meaning of a Const Member Function</strong>\<br />
- The <em>this</em> pointer in a non-const member function of a class X is X* const.</p>
<p><code>class X {<br />
    public:<br />
        X(): buffer_(0), isComputed_(false) {}<br />
        // ..<br />
        void setBuffer() {<br />
            int *tmp = new int[MAX];<br />
            delete [] buffer_;<br />
            buffer_ = tmp;<br />
        }<br />
        <strong>void modifyBuffer( int index, int value ) const // immoral</strong><br />
            { buffer_[index] = value; }<br />
        int getValue() const {<br />
            if( !isComputed_ ) {<br />
                computedValue_ = expensiveOperation();  // error<br />
                isComputed_ = true; // error<br />
            }<br />
             return computedValue_;<br />
        }<br />
    private:<br />
        static int expensiveOperation();<br />
        int *buffer_;<br />
        bool isComputed_;<br />
        int computedValue_;<br />
};</p>
<p>    int getValue() const {<br />
         if(isComputed_) {<br />
             X * const aThis = const_cast(this); // bad idea<br />
            aThis-&gt;computedValue_ = expensiveOperation();<br />
            aThis-&gt;isComputed_ = true;<br />
         }<br />
         return computedValue_;<br />
    }</code></p>
<p>- the proper way is to make the data members mutable.<br />
<code>    class X {<br />
        public:<br />
            // ...<br />
            int getValue() const {<br />
                if( !isComputed_ ) {<br />
                    <strong>computedValue_ = expensiveOperation(); // fine</strong><br />
                    isComputed_ = true; // also fine<br />
                }<br />
                 return computedValue_;<br />
            }<br />
        private:<br />
            //...<br />
            mutable bool isComputed_;<br />
            mutable int computedValue_;<br />
    };</code><br />
<code><br />
class X {<br />
    public:<br />
        //...<br />
        X operator+( const X &amp;rightArg ); // left arg is non-const<br />
        X operator+(const X &amp;rightArg );  // left arg is const<br />
};<br />
</code><br />
<strong>Item 11 &#8211; The Compiler Puts Stuff in Classes</strong><br />
- most C++ programmers know that if a class declares one or more virtual functions, then the compiler will insert in each object of that class a pointer to a virtual function table.</p>
<p>POD &#8211; Plain Old Data (guaranteed not to be rearranged by the compiler)<br />
<code>struct s { // a POD-struct<br />
    int a;<br />
    double b;<br />
};</code></p>
<p>Non-POD<br />
<code>struct s {<br />
    int a;<br />
    double b;<br />
private:<br />
    std::string c; // some maintenance<br />
};</code></p>
<p>- never make assumptions about the internal structure of your classes!</p>
<p><strong>Item 12 &#8211; Assignment and Initialization Are Different</strong><br />
* 1/2 Assignment *<br />
   &#8211; occurs when you assign<br />
   &#8211; somewhat like destruction then followed by a construction<br />
* 2/2 Initialization *</p>
<p>int a = 12; // initialization, copy 0x000C to a<br />
a = 12; // assignment, copy 0x000C to a</p>
<p>Don&#8217;t do the following:<br />
String *names = static_cast(::operator new( BUFSIZ ));<br />
names[0] = &#8220;Sakamoto&#8221;; // oops! delete [] uninitialized pointer!</p>
<p><strong>Item 13 &#8211; Copy Operations</strong><br />
- Copy construction and copy assignment are different operations.</p>
<p><code>class Impl;<br />
class Handle {<br />
    public:<br />
        //...<br />
        Handle( const Handle &amp;);   // copy ctor<br />
        Handle &amp;operator= (const Handle &amp;); // copy assignment<br />
        void swap( Handle &amp;);<br />
        //...<br />
    private:<br />
        Impl *impl; // pointer to implementation of handle<br />
};</code></p>
<p>An implementation of a typical non-member swap<br />
<code>template<br />
void swap(T &amp;a, T &amp;b ) {<br />
    T temp(a);  // T's copy ctor<br />
    a = b;        // T's copy assignment<br />
    b =  temp;  // T's copy assignment<br />
}</code></p>
<p>// enhanced function<br />
<code>inline void Handle::swap(Handle &amp;that)<br />
{ std::swap( impl_; that.impl; }</code></p>
<p>Handle &amp;Handle::operator = (const Handle &amp; that) {<br />
    Handle temp( that ); // exception safe copy con<br />
    swap(temp); // exception safe swap<br />
    return *this;<br />
}</p>
<p>A more common implementation of copy assignment:</p>
<p><code>Handle &amp;Handle::operator=( const Handle &amp;that ) {<br />
    if( this != &amp;that ) {<br />
        // do assignment<br />
    }<br />
    return *this;<br />
}<br />
</code></p>
<p><strong>Item 14 &#8211; Function Pointers</strong><br />
- used traditioally for implementing callback functions<br />
-<br />
void (*fp)(int);<br />
 &#8211;<br />
extern int f( int );<br />
extern void g( long );<br />
extern void h( int );<br />
//&#8230;<br />
fp = f;  // error! incompatible<br />
fp = g; // error! incompatible<br />
fp = 0; // set to null<br />
fp = h; // OK<br />
fp = &amp;h; // OK, take address explicitly but not necessary</p>
<p>(*fp)(12); // explicit dereference but not necessary<br />
fp(12); // implicit</p>
<p>* A Callback Function *<br />
extern void stopDropRoll();<br />
inline void jumpIn() { &#8230; }<br />
//&#8230;<br />
void (*fireaction)() = 0;<br />
//&#8230;<br />
if( !fatalist ) { //<br />
    if( nearWater )<br />
        fireaction = jumpIn;<br />
    else<br />
        fireaction = stopDropRoll;<br />
}</p>
<p>if( ftemp &gt;= 451 ) { // If there is a fire<br />
    if( fireaction ) // .. and an action to execute<br />
        fireaction(); // .. execute it<br />
}</p>
<p>It is also legal to take the address of an overloaded function:<br />
void jumpIn() // gets selected<br />
void jumpIn( bool canSwim );<br />
// &#8230;<br />
fireAction = jumpIn;</p>
<p><strong>Item 15 &#8211; Pointers to Class Members Are Not Pointers</strong><br />
int *ip; // pointer to an int<br />
int C::*pimC; // pointer to an int member of C</p>
<p>// a regular pointer<br />
int a = 12;<br />
ip = &amp;a;<br />
*ip = 0;<br />
a = *ip;</p>
<p>class C {<br />
    public:<br />
       //&#8230;<br />
       int a_;<br />
};</p>
<p>int C::*pimC; // pointer to an int member of C<br />
C aC;<br />
C *pC = &amp;aC; // does not give us an address; it gives us an offset<br />
aC.*pimC = 0;<br />
int b = pC-&gt;*pimC;</p>
<p>* A pointer to a data member is not a pointer to an object; it&#8217;s an offset into an object<br />
class Shape {<br />
    //&#8230;<br />
    Point center_;<br />
    //&#8230;<br />
};</p>
<p>class Circle : public Shape {<br />
    //&#8230;<br />
    double radius_;<br />
    //&#8230;<br />
};</p>
<p>Point Circle::*loc = &amp;Shape::center_; //OK, base to derived<br />
double Shape::*extent = &amp;Circle::radius_; // error! derived to base</p>
<p><strong>Item 16 &#8211; Pointers to Member Functions Are Not Pointers</strong><br />
- the address of a non-static member function does not give you an address, it gives you the pointer to the member function<br />
-<br />
class Shape {<br />
    public:<br />
        //&#8230;<br />
        void moveTo( Point newLocation );<br />
        bool validate() const;<br />
        virtual bool draw() const = 0;<br />
        //&#8230;<br />
};<br />
class Circle : public Shape {<br />
    //&#8230;<br />
    bool draw() const;<br />
    //..<br />
};<br />
//&#8230;<br />
void (Shape::*mf1)( Point ) = &amp;Shape::moveTo; // not a pointer<br />
bool (Shape::*mf2)() const = &amp;Shape::validate;</p>
<p>Circle circ;<br />
Shape *pShape = &circ;<br />
(pShape-&gt;*mf2)(); // call Shape::validate<br />
(circ.*mf2)(); // same</p>
<p>mf2 = &amp;Shape::draw; // draw is virtual<br />
(pShape-&gt;*mf2)(); // call Circle::draw</p>
<p>class B {<br />
    public:<br />
        void bset( int val ) { bval_ = val; }<br />
    private:<br />
        int bval_;<br />
};</p>
<p>class D {<br />
    public:<br />
        void dset( int val ) { dval_ = val; }<br />
    private:<br />
        int dval_;<br />
};</p>
<p>B b;<br />
D d;<br />
void (B::*f1)(int) = &amp;D::dset; // error! derived func in base ptr<br />
(b.*f1)(12); // oops! access nonexistent dval member!<br />
void (D::*f2)(int) = &amp;B::bset; // OK, base func in derived ptr<br />
(d.*f2)(11); // OK, set inherited bval data member</p>
<p><strong>Item 17 &#8211; Dealing with Function and Array Declarators</strong><br />
int *f1(); // function that returns int *<br />
int (*fp1)(); // ptr to a function that returns int</p>
<p>const int N = 12;<br />
int *a1[N]; // array of N int *<br />
int (*ap1)[N]; // ptr to array of N ints<br />
int (**ap2)[N]; // ptr to ptr to array of N ints</p>
<p><strong>Item 18 &#8211; Function Objects</strong><br />
<strong>Item 19 &#8211; Commands and Hollywood</strong><br />
<strong>Item 20 &#8211; STL Function Objects</strong><br />
<strong>Item 21 &#8211; Overloading and Overriding Are Different</strong><br />
- Nothing in common. Entirely different concepts.</p>
<p>Overloading<br />
- occurs when two or more functions in the same scope have the same function name but different signature</p>
<p>Overriding<br />
- occurs when a derived class function has the same name and signature as base class virtual function.</p>
<p>class B {<br />
    public:<br />
        //&#8230;<br />
        virtual int f( int ); // bad code<br />
        void f( B* );        // bad code<br />
        // ..<br />
};</p>
<p>Bad code<br />
- do not overload a virtual function<br />
- do not overload on both integral and a pointer type.</p>
<p>class D : public B {<br />
    public:<br />
       int f( int ); // overrides the Base class function<br />
       int f(B*);   // doesn&#8217;t override anything<br />
};</p>
<p><strong>Item 22 &#8211; Template Method</strong><br />
- If you don&#8217;t like the contract specified by the Base class, find a different base class. Don&#8217;t attempt to rewrite its contract.<br />
- an example of the Hollywood principle. &#8220;Don&#8217;t call us, we&#8217;ll call you.&#8221;</p>
<p>class App {<br />
    public:<br />
        virtual ~App();<br />
        //&#8230;<br />
        void startup() { // template method<br />
            initialize();<br />
            if( !validate() )<br />
                altInit();<br />
        }<br />
    protected:<br />
        virtual bool validate() const = 0; // we&#8217;ll call you<br />
        virtual void altInit(); // we&#8217;ll call you<br />
        //&#8230;<br />
    private:<br />
        void initialize();<br />
        //&#8230;<br />
}:</p>
<p>class MyApp : public App {<br />
    public:<br />
        //&#8230;<br />
    private:<br />
        //&#8230;<br />
        void validate() const;<br />
        void altInit();<br />
        //&#8230;<br />
};</p>
<p><strong>Item 23 &#8211; Namespaces</strong></p>
<p>// wrong</p>
<p><code>#include<br />
#include<br />
using namespace std;<br />
using namespace org_semantics;<br />
- This is a bad idea.. All the names from the namespace is available everywhere.. </code></p>
<p>// right<br />
<code>void aFunc() {<br />
    using namespace std;<br />
    // ..<br />
    int vector  = 12; // a poorly named local variable<br />
    vector a;    // error! std::vector is hidden<br />
    std::vector b;  // OK, can use explicit qualification</p>
<p>}</code></p>
<p>* way to deal with long, tedious namespace name is to use an alias<br />
    namespace S = org_semantics;</p>
<p><strong>Item 24 &#8211; Member Function Lookup</strong></p>
<p><strong>Item 25 &#8211; Argument Dependent Lookup</strong></p>
<p><strong>Item 26 &#8211; Operator Function Lookup</strong></p>
<p>// A class that overloads an operator as a member function<br />
class X {<br />
    public:<br />
        X operator %( const X &amp; ) const; // binary modulus<br />
        X memFunc1( const X &amp; );<br />
        void memFunc2();<br />
        //&#8230;<br />
};</p>
<p>X a, b, c;<br />
a = b % c; // infix call to member operator %<br />
a = b.operator %( c ); // member function call<br />
a = b.memFunc( c ); // another</p>
<p>X operator %( const X &amp;, int ); // non-member operator<br />
//&#8230;<br />
void X::memFunc2() {<br />
    *this % 12; // calls non-member operator %<br />
     operator %( *this, 12 ); // error! To many args<br />
}</p>
<p><strong>Item 27 &#8211; Capability Queries</strong><br />
class Shape {<br />
    public:<br />
        virtual ~Shape();<br />
        virtual void draw() const = 0;<br />
        //&#8230;<br />
};<br />
//&#8230;<br />
Shape *s  = getSomeShape(); // get a shape, and tell it<br />
s-&gt;draw(); // to work</p>
<p>// an interface class<br />
- a class with no non-static data members<br />
- no declared constructor<br />
- a virtual destructor<br />
- with a set of pure virtual functions</p>
<p>class Rollable {<br />
    public:<br />
        virtual ~Rollable();<br />
        virtaul void roll() = 0;<br />
};</p>
<p>// Circles Roll<br />
class Circle : public Shape, public Rollable {<br />
    //&#8230;<br />
    void draw() const;<br />
    void roll();<br />
    //&#8230;<br />
};</p>
<p>// Squares dont<br />
class Square : public Shape {<br />
    //&#8230;<br />
    void draw() const;<br />
    //&#8230;<br />
};</p>
<p>In C++, capability query is<br />
- typically expressed as a dynamic_cast between unrelated types.<br />
- dynamic_cast is often called &#8220;cross-cast&#8221;<br />
- it checks whether an object implements the Rollable interface, dynamic_cast will fail if s refers to a Square.</p>
<p>Shape *s = getSomeShape(); // will succeed<br />
Rollable *roller = dynamic_cast(s);</p>
<p>Is this Shape Rollable?<br />
<a href="http://lookdit.files.wordpress.com/2010/05/rollable1.jpg"><img src="http://lookdit.files.wordpress.com/2010/05/rollable1.jpg?w=497" alt="" title="Is this Shape Rollable"   class="alignleft size-full wp-image-230" /></a></p>
<p>
&#8220;May I tell this shape to roll?&#8221;</p>
<p>Shape *s = getSomeShape();<br />
if( Rollable *roller = dynamic_cast(s) )<br />
    roller-&gt;roll();</p>
<p>* Capablity queries are occasionally required, but they tend to be overused.<br />
* Often an indicator of bad design.<br />
* Best to avoid making runtime queries</p>
<p><strong>Item 28 &#8211; Meaning of Pointer Comparison</strong><br />
&#8220;a question about object entity&#8221;<br />
- an object can contain multiple, valid addresses<br />
class Shape {&#8230;};<br />
class Subject {&#8230;};<br />
class ObservedBlob : public Shape, public Subject { &#8230; };</p>
<p>ObservedBlob *ob = new ObservedBlob;<br />
Shape *s = ob; // predefined conversion<br />
Subject *s = ob; // predefined conversion</p>
<p>if( ob == s ) &#8230; // works fine, true<br />
if( subj == ob ) &#8230; // works fine, true</p>
<p>- Pointers to void are common culprits.<br />
void *v = subject;<br />
if( ob == v ) // not equal</p>
<p><strong>Item 29 &#8211; Virtual Constructors and Prototype</strong><br />
- a member function that provides the ability to clone an object is traditionally called a &#8220;virtual constructor&#8221;.<br />
- called &#8220;an instance of the Prototype pattern&#8221;</p>
<p>class Meal {<br />
    public:<br />
        virtual ~Meal();<br />
        virtual void eat() = 0;<br />
        virtual Meal *clone() const = 0; // a factory method<br />
        //&#8230;<br />
};</p>
<p>// Concrete classes must provide an implementation of the pure virtual clone operation.<br />
class Spaghetti {<br />
    public:<br />
        Spaghetti( const Spaghetti &amp; ); // copy ctor<br />
        void eat();<br />
        Spaghetti *clone() const<br />
<strong>            { return new Spaghetti( *this ); } // call copy ctor</strong><br />
        //&#8230;<br />
};</p>
<p>- we can now create a meal without precise knowledge of the type of meal</p>
<p>const Meal *m = thatGuysMeal(); // whatever he is eating<br />
Meal *myMeal = m-&gt;clone(); // .. I have a meal same with the other guy</p>
<p>Advantage of ignorance in software design&#8230;<br />
- &#8220;The less you know, the better&#8221;</p>
<p><strong>Item 30 &#8211; Factory Method</strong><br />
- one common approach that is always wrong is the use of a type code and a switch statement<br />
- the essence of FM is that the base class provide a virtual function hook (e.g. genInfo() ), for generating an appropriate &#8220;product&#8221;.<br />
- often the cure for a series of runtime type check queries.</p>
<p><code>class Employee {<br />
    public:<br />
        enum Type { SALARY, HOURLY, TEMP };<br />
        Type type() const { return type_; }<br />
        //...<br />
    private:<br />
        Type type_;<br />
        //...<br />
};</p>
<p>HRInfo *genInfo( const Employee &amp;e ) {<br />
    switch( e.type()) {<br />
        case SALARY:<br />
        case HOURLY: return new StdInfo( e );<br />
        case TEMP: return new TempInfo( static_case (e) );<br />
        default: return 0;<br />
    }<br />
}</code></p>
<p>The use of dynamic_cast to ask a series of personal questions of the Employee object is bad.</p>
<p><code>HRInfo *genInfo( const Employee &amp;e ) {<br />
    if( const Salary *s  = dynamic_cast(&amp;e) )<br />
        return new StdInfo( s );<br />
    else if( const Hourly *h =  dynamic_cast(&amp;e) )<br />
        return new StdInfo( h );<br />
    else if( const Temp *t = dynamic_cast(&amp;e) )<br />
        return new TempInfo( t );<br />
    else<br />
        return 0; // unknown employee type<br />
}</code></p>
<p>The problem in the above code is the coupling to the concrete types. To fix the problem:</p>
<p><code>class Employee {<br />
    public:<br />
        //...<br />
        // Factory Method - virtual, abstract class<br />
        virtual HRInfo *genInfo() const = 0;<br />
        //...<br />
};</p>
<p>class Temp : public Employee {<br />
    public:<br />
        //...<br />
    TempInfo *genInfo() const<br />
        { return new TempInfo( *this ); }<br />
        //...<br />
};<br />
</code><br />
&#8220;Whatever type of employee you are, generate the appropriate type of information for yourself&#8221;</p>
<p><code>Employee *e = getAnEmployee();<br />
//...<br />
HRInfo *info =  e-&gt;genInfo(); // use factory method</code></p>
<p><strong>Item 31 &#8211; Covariant Return Types</strong></p>
<p><strong>Item 32 &#8211; Preventing Copying</strong></p>
<p><code>class NoCopy {<br />
    public: NoCopy(int)<br />
    // ..<br />
    private: NoCopy(const NoCopy &amp;);    // copy ctor<br />
    private: NoCopy &amp;operator= (const NoCopy &amp;); // copy assignment<br />
};</code></p>
<p>- this prevents the compiler to generate implicitly copy ctor and copy assignment.</p>
<p><code>void aFunc(NoCopy);<br />
void anotherFunc(const NoCopy &amp;);<br />
NoCopy a(12);<br />
NoCopy b(a); // error! copy ctor<br />
NoCopy c = 12; // error! copy assignment<br />
a = b; // error! copy assignment<br />
aFunc(a); // error! pass by value with copy ctor<br />
aFunc(12);  // error! implicit copy ctor<br />
anotherFunc(a); // Ok, pass by ref<br />
anotherFunc(12); // Ok</code></p>
<p><strong>Item 33 &#8211; Manufacturing Abstract Bases</strong></p>
<p>// an example of an Abstract Base Class<br />
class ABC {<br />
    public:<br />
        virtual ~ABC();<br />
        virtual void anOperation() = 0; // pure<br />
        //&#8230;<br />
};</p>
<p>// another example of an Abstract Base Class that does<br />
// not have virtual function yet a candidate as a Base Class</p>
<p>class ABC {<br />
    public:<br />
       virtual ~ABC();<br />
    protected:<br />
        ABC();<br />
        ABC(const ABC &amp;);<br />
        // &#8230;<br />
};</p>
<p>class D: public ABC {<br />
    // &#8230;<br />
};</p>
<p>This codes prevents the creation of standalone ABC objects.</p>
<p>void func1(ABC);<br />
void func2(ABC&amp;);<br />
ABC a; // error! protected default ctor<br />
D d; // OK<br />
func1(d); // error! protected copy ctor<br />
func2(d); // Ok, no copy ctor , passed by ref</p>
<p>- second approach<br />
class ABC {<br />
    public:<br />
        virtual ~ABC()=0;<br />
        //&#8230;<br />
};<br />
//&#8230;</p>
<p>ABC::~ABC(){&#8230;}<br />
- destructor is often a good choice to make the class as abstract</p>
<p>- third approach<br />
  when a class has no virtual functions at all, and no need for explicitly declared constructors, a protected virtual destructor is good</p>
<p>class ABC {<br />
    protected:<br />
        ~ABC();<br />
    public:<br />
        //&#8230;<br />
};</p>
<p>the code above has the same effect as a protected constructor, but the error occurs when the object goes out of scope or destroyed expicitly.</p>
<p><strong>Item 34 &#8211; Restricting Heap Allocation</strong><br />
- Benefits -<br />
1. To ensure that the destructor is always called.<br />
2. Local objects with auto storage class will have their destructor called automatically. (except in abnormal scenes like exit and abort )</p>
<p><code>class NoHeap {<br />
    public:<br />
        //...<br />
    protected: // may be declared as private if not intended to be use as base class.<br />
        void *operator new( size_t ) return 0;}<br />
        void operator delete( void * ) {}<br />
    private:<br />
        void *operator new[]( size_t );<br />
        void operator delete[]( void * );</p>
<p>};<br />
</code><br />
thus calls to allocate object will result to compile-time error.</p>
<p>NoHeap *nh = new NoHeap; // error! protected NoHeap::operator new<br />
//&#8230;<br />
delete nh; // error! protected NoHeap::operator delete</p>
<p><strong>Item 35 &#8211; Placement New</strong><br />
- a trick the compiler into calling a constructor for us<br />
- a standard, global overloaded version of operator new that cannot be replaced with a user-defined version<br />
void *operator new( size_t, void *p ) throw()<br />
    { return p; }</p>
<p>You can refer to <a href="http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.10"> C++ Faq Lite </a> for more details.</p>
<p><strong>Item 36 &#8211; Class-Specific Memory Management</strong><br />
- you can implement operator new/detete to customize your needs, which are static members</p>
<p>class Handle {<br />
    public:<br />
        //&#8230;<br />
        void *operator new( size_t );<br />
        void operator delete( void * );<br />
        //&#8230;<br />
};</p>
<p>//&#8230;<br />
Handle *h = new Handle;<br />
//&#8230;<br />
delete h;</p>
<p>class MyHandle : public Handle {</p>
<p>};</p>
<p><strong>Item 37 &#8211; Array Allocation</strong></p>
<p><strong>Item 38 &#8211; Exception Safety Axioms</strong></p>
<p><strong>Item 39 &#8211; Exception Safe Functions</strong></p>
<p><strong>Item 40 &#8211; RAII</strong></p>
<p><strong>Item 41 &#8211; New, Contructors, and Exceptions</strong></p>
<p><strong>Item 42 &#8211; Smart Pointers</strong><br />
- A class type that is tricked up to look and act like a pointer but that provides additional capability beyond that provided by a<br />
built-in pointer.<br />
- All SP overload the  -&gt; and * operators so that they can be used with standard pointer syntax.<br />
- SP are often implemented as class templates so that they may refer to different types of objects.</p>
<p><code>template<br />
class CheckedPtr {<br />
    public: explicit CheckedPtr(T* p) : p_(p) {}<br />
    public: ~CheckedPtr() { delete p_; }<br />
    public: T* operator -&gt;() { return get(); }<br />
    public: T&amp; operator*() { return get(); }<br />
    private: T * p_;  // what we're pointing to<br />
    private: T* get() {<br />
        if(!p_) // check pointer before returning it<br />
            throw NullCheckedPointer();<br />
        return p_;<br />
    }<br />
    private: CheckedPtr(const CheckPtr &amp;);<br />
    private: CheckedPtr &amp;operator = (const CheckedPtr &amp;);<br />
};</p>
<p>CheckedPtr s (new Circle);<br />
s-&gt;draw; // same as (s.operator-&gt;())-&gt;draw();</code></p>
<p>- SP also typically overload operator * as well as operator -&gt; so that they may be used to refer to non class types.<br />
<code>CheckedPtr ip = new int;<br />
*ip = 12; // same as ip.operator *() = 12;<br />
(*s).draw();  // use on ptr to class, too</code></p>
<p><strong>Item 43 &#8211; auto_ptr Is Unusual</strong><br />
- RAII<br />
- a resource handle template that serves many resource handle needs<br />
- it overloads operator-&gt; and operator *<br />
- it is very efficient (1)<br />
- its destructor will free whatever it is pointing to (2)<br />
- it behaves like a built-in pointer (3)</p>
<p><code>using std::auto_ptr;<br />
auto_ptr aShape ( new Circle );<br />
aShape-&gt;draw(); // draw a Circle<br />
(*aShape).draw(); // draw it again<br />
</code></p>
<p>auto_ptr aCircle( new Circle );<br />
aShape = aCircle; // valid</p>
<p>2 Situations where auto_ptr should be avoided:<br />
1) Don&#8217;t use as container elements<br />
2) auto_ptr should refer to a single element, not an array because when the object which the auto_ptr refers is deleted,<br />
    it will be deleted via operator delete, not array delete.</p>
<p>vector&lt;auto_ptr &gt; shapes; // likely error, bad idea<br />
auto_ptr ints ( new int[32] ); // bad idea, no error (yet)</p>
<p>- A standard vector or string is a reasonable alternative to an auto_ptr to an array</p>
<p><strong>Item 44 &#8211; Pointer Arithmetic</strong><br />
- simple and straightforward<br />
- there is no pointer arithmetic available on void *</p>
<p>const int MAX = 10;<br />
short points[MAX];<br />
shot *curPoint = points+4;</p>
<p>** One Dimensional **<br />
<a href="http://lookdit.files.wordpress.com/2010/05/pointer.jpg"><img src="http://lookdit.files.wordpress.com/2010/05/pointer.jpg?w=497" alt="" title="Pointer Arithmetic"   class="alignleft size-full wp-image-237" /></a></p>
<p>const int ROWS = 2;<br />
const int COLS = 3;<br />
int table[ROWS][COLS]; // array of ROWS arrays of COLS ints<br />
int (*ptable)[ROWS][COLS] = table; // pointer to array of COLS ints</p>
<p><a href="http://lookdit.files.wordpress.com/2010/05/layout2.jpg"><img src="http://lookdit.files.wordpress.com/2010/05/layout2.jpg?w=497" alt="" title="Multidimensional Array"   class="alignleft size-full wp-image-238" /></a></p>
<p>STL iterators also permit pointer-like arithmetic operation like the built-in pointers.</p>
<p>int a[] = {1,2,3,4};<br />
std::list lst (a, a+3 );<br />
std::list::iterator iter = lst.begin();<br />
++iter;</p>
<p><strong>Item 45 &#8211; Template Terminology</strong></p>
<p>template typename // T is a template parameter<br />
class Heap { &#8230; };<br />
//&#8230;</p>
<p>Heap heap; // double is a template argument</p>
<p>template  // typename T is a template-parameter list<br />
class Heap;                 // Heap is the template name<br />
template<br />
class Heap          // Heap is the template-id<br />
template<br />
class Heap      // char * is the template-argument list<br />
//&#8230;<br />
Heap aHeap;       //  like char *<br />
Heap aHeap2;  // Heap is a template-id<br />
template<br />
void print (const T &amp;x ) { &#8230;  // print is a template-name</p>
<p>Template instantiation:<br />
-    when the primary heap template is used,or partial, an instantiation will take place<br />
Template specialization:<br />
-    is what you get when you supply a template with a set of template arguments.<br />
-    can be implicit or explicit<br />
     // Heap is explicit<br />
     // print(12.3) is implicit</p>
<p><strong>Item 46 &#8211; Class Template Explicit Specialization</strong><br />
- </p>
<p><strong>Item 47 &#8211; Template Partial Specialization</strong></p>
<p><strong>Item 48 &#8211; Class Template Member Specialization</strong></p>
<p><strong>Item 49 &#8211; Disambiguating with Typename</strong></p>
<p><strong>Item 50 &#8211; Member Templates</strong></p>
<p><strong>Item 51 &#8211; Disambiguating with Template</strong></p>
<p><strong>Item 52 &#8211; Specializing for Type Information</strong></p>
<p><strong>Item 53 &#8211; Embedded Type Information</strong></p>
<p><strong>Item 54 &#8211; Traits</strong></p>
<p><strong>Item 55 &#8211; Template Template Parameters</strong></p>
<p><strong>Item 56 &#8211; Policies</strong></p>
<p><strong>Item 57 &#8211; Template Argument Deduction</strong></p>
<p><strong>Item 58 &#8211; Overloading Function Templates</strong></p>
<p><strong>Item 59 &#8211; SFINAE</strong><br />
-  Substitution Failure Is Not An Error by Vandevoorde and Josuttis</p>
<p><strong>Item 60 &#8211; Generic Algorithms</strong><br />
- a function template that is designed in such a way that it can be easily and effectively customized at compile time according to the context of its use.</p>
<p>// not a proper gen algo<br />
    &#8211; sorting is Slow, better use String&#8217;s own swap method<br />
<code><br />
template<br />
void slowSort(T a[], int len) {<br />
    for(int i = 0; i &lt; len; ++i) // for each pair<br />
        for(int j = 0; j &lt; len; ++j)<br />
           if(a[j] &lt; a[i]) { // ... if out of order<br />
              T tmp(a[j]);<br />
              a[j] = a[i];<br />
              a[i] = tmp;<br />
           }<br />
}</p>
<p>String names[] = { &quot;my&quot;, &quot;dog&quot;, &quot;has&quot;, &quot;fleece&quot; };<br />
const int namesLen = sizeof(names)/sizeof(names[0]);<br />
slowSort(names, namesLen);</code></p>
<p>// right</p>
<p><code><br />
template<br />
void slowSort(T a[], int len) {<br />
    for(int i = 0; i &lt; len; ++i) // for each pair<br />
        for(int j = 0; j &lt; len; ++j)<br />
           if(a[j] &lt; a[i]) { // ... if out of order<br />
               swap(a[j],a[i]); // ... swap them<br />
           }<br />
}</p>
<p>inline void swap(String &amp;a, String &amp;b)<br />
{ a.swap(b);}</code></p>
<p>class State {<br />
    /// &#8230;<br />
    public: int population() const;<br />
    public: float aveTempF() const;<br />
    // &#8230;<br />
};</p>
<p>// best &#8211; more standard and more flexible STL compliant iterator interface<br />
<strong><br />
template<br />
void slowSort( For b, For e, Comp less ) {<br />
    for( For i(b); i != e; ++i) // for each pair<br />
        for(For j(i); j != e; ++j)<br />
            if( less(a[j], a[i])) // &#8230; if out of order<br />
                swap(a[j], a[i]); // &#8230; swap them</p>
<p>}</p>
<p>template<br />
void slowSort(For b, For e) {<br />
    for( For i(b); i != e; ++i) // for each pair<br />
        for(For j(i); j != e; ++j)<br />
            if( a[j] &lt; a[i]) // &#8230; if out of order<br />
                swap(a[j], a[i]); // &#8230; swap them</p>
<p>// &#8230;<br />
std::list states;<br />
// &#8230;<br />
slowSort(states.begin(), states.end(), PopComp());<br />
slowSort(names, names + namesLen);<br />
// &#8230;<br />
</strong><br />
<strong>Item 61 &#8211; You Instantiate What You Use</strong><br />
<code>template<br />
class Array {<br />
    public: Array() : a_(new T[n]) {}<br />
    public: ~Array() { delete [] a_;}<br />
    public: Array(const Array &amp;);<br />
    public: Array &amp;operator = (const Array &amp;);<br />
    public: void swap(Array &amp;that) { std::swap(a_, that.a_); }<br />
    public: T &amp;operator[](int i) { return a_[i];}<br />
    public: const T &amp;operator[](int i) {return a_[i];}<br />
    public: bool operator ==(const Array &amp;rhs) const;<br />
    public: bool operator != (const Array &amp;rhs) const;<br />
};</p>
<p>template<br />
bool Array::operator==(const Array &amp;rhs) const<br />
{<br />
    for(int i = 0; i &lt; n; ++i)<br />
        if( !(a_[i] == that.a_[i])<br />
            return false;<br />
     return true;<br />
}</p>
<p>Array a, b;<br />
if(a == b) // calls a.operator ==(b)<br />
    // ...</p>
<p></code></p>
<p>The template member function will never be instantiated if there is no call on the template member functions. This thus reduces code size. </p>
<p>For types that does not override the == operator, there will be a problem.. for example,</p>
<p>Array c,d;  // no problem<br />
//&#8230;<br />
c[3].draw(); // OK, we are not yet calling == operator</p>
<p>if(c == d) // error, because there is no overload of == operator in class Circle..</p>
<p><strong>Item 62 &#8211; Include Guards</strong><br />
- preventing the content of a header file from appearing more than once in a compilation no matter how many times the header file is actually #included.</p>
<p>* in .h file<br />
#ifndef HDR1_H<br />
#define HDR1_H<br />
..</p>
<p>#endif</p>
<p>* in .cpp file<br />
#ifndef HDR1_H<br />
#include &#8220;hdr1.h&#8221;<br />
#endif<br />
 &#8211; rather than #include a header file, there is a guard in the inclusion with a test on the same guard symbol that is set within the header file. This is redundant, because the first time a header file is include, the same condition will be tested twice, both before the #include and within the header file itself.<br />
- use of redundant include guards is not as common as that of simple include guards, but in some case their use can improve the<br />
compilation time of large applications considerably.</p>
<p><strong>Item 63 &#8211; Optional Keywords</strong><br />
* one source of confusion is the optional use of virtual in a derived class member function that overrides a base class virtual member function.</p>
<p><code>class Shape {<br />
    public: virtual void draw() const = 0;<br />
    public: virtual void rotate(double degrees ) = 0;<br />
    public: virtual void invert() = 0;<br />
};</p>
<p>class Blob : public Shape {<br />
    public: virtual void draw() const;<br />
    public: void rotate(double); // misassumption that omitting the virtual keyword will prevent further overriding in more derive<br />
                                          // classes<br />
    public: void invert() = 0;<br />
};</p>
<p>class SharpBlob : public Blob {<br />
    public: void rotate(double); // overrides Blob::rotate without the keyword virtual (misassumption)<br />
};</code></p>
<p>* Omitting the virtual keyword<br />
    &#8211; some authorities claim that use of the nonessential virtual helps to document the nature of the derived class<br />
    &#8211; others claim it is a waste of effort and may cause a nonoverriding derived class function to become accidentally virtual</p>
<p>* another source of confusion is the static keyword<br />
    &#8211; the static keyword is optional when declaring member operator new, operator delete, array new, and array delete because these<br />
       functions are implicitly static</p>
<p><code>class Handle {<br />
    public: void *operator new(size_t); // implicitky static<br />
    public: static void operator delete(void *);<br />
    public: static void *operator new[](size_t);<br />
    public: void operator delete[](void*); // implicitly static<br />
};</code></p>
<p>* keywords typename and class in a template header<br />
    &#8211; many expert c++ programmers use typename to indicate to the human reader that the template argument may be of any type and class to indicate that the type argument must be a class type.<br />
<code><br />
template<br />
Out copy(In begin, In end, Out result);</p>
<p>template<br />
void resize(Contatiner &amp;container, int newsize);</code></p>
<p>* keyword register<br />
    &#8211; in ancient times it is used to &#8220;suggest&#8221; to the compiler that a variable was (in the opinion of the programmer) going to be heavily used and should be therefore be put in the register<br />
    &#8211; in C++, use of register has &#8220;NO EFFECT&#8221; whatsoever on the efficiency of the program.</p>
<p>* keyword auto<br />
    &#8211; to indicate automatic variable or function</p>
<p>- keyword register and auto can be used in obscure circumstances to disambiguate the syntax particularly poor written code.<br />
- avoid the use of these keywords<br />
&#8212; FIN &#8212;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lookdit.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lookdit.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lookdit.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lookdit.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lookdit.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lookdit.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lookdit.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lookdit.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lookdit.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lookdit.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lookdit.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lookdit.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lookdit.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lookdit.wordpress.com/178/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=178&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lookdit.wordpress.com/2010/05/27/c-common-knowledge-by-stephen-c-dewherst/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c7af6cb775f23abf74e9696dc57af8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nerwinc0hernando</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/05/rollable1.jpg" medium="image">
			<media:title type="html">Is this Shape Rollable</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/05/pointer.jpg" medium="image">
			<media:title type="html">Pointer Arithmetic</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/05/layout2.jpg" medium="image">
			<media:title type="html">Multidimensional Array</media:title>
		</media:content>
	</item>
		<item>
		<title>Handle &#8211; Body Pattern</title>
		<link>http://lookdit.wordpress.com/2010/05/21/handle-body-pattern/</link>
		<comments>http://lookdit.wordpress.com/2010/05/21/handle-body-pattern/#comments</comments>
		<pubDate>Fri, 21 May 2010 06:04:14 +0000</pubDate>
		<dc:creator>nerwin hernando</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://lookdit.wordpress.com/?p=212</guid>
		<description><![CDATA[The handle-body design pattern is one of the list of unknown term to me. I heard these during our meeting with our technical director, and so I googled the term to be able to understand the application of this pattern.. You can use the lookup words &#8220;Handle Body Pattern C++&#8221;.. Widely known as &#8220;The C++ [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=212&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The handle-body design pattern is one of the list of unknown term to me. I heard these during our meeting with our technical director,<br />
and so I googled the term to be able to understand the application of this pattern.. You can use the lookup words &#8220;Handle Body Pattern C++&#8221;.. Widely known as &#8220;The C++ Pimpl &#8220;.</p>
<p>Pages:</p>
<p>1) http://www.go4expert.com/forums/showthread.php?t=16405<br />
2) http://www2.roguewave.com/support/docs/hppdocs/thrug/7-3.html<br />
3) http://www.drdobbs.com/cpp/205918714;jsessionid=XH5ABZ1V1EOYVQE1GHOSKHWATMY32JVN<br />
4) http://www.gamedev.net/reference/articles/article1794.asp<br />
n) &#8230; other results from google..</p>
<p>Worth reading.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lookdit.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lookdit.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lookdit.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lookdit.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lookdit.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lookdit.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lookdit.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lookdit.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lookdit.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lookdit.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lookdit.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lookdit.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lookdit.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lookdit.wordpress.com/212/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=212&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lookdit.wordpress.com/2010/05/21/handle-body-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c7af6cb775f23abf74e9696dc57af8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nerwinc0hernando</media:title>
		</media:content>
	</item>
		<item>
		<title>MessageQueue in C#</title>
		<link>http://lookdit.wordpress.com/2010/01/27/messagequeue-in-c/</link>
		<comments>http://lookdit.wordpress.com/2010/01/27/messagequeue-in-c/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 11:40:44 +0000</pubDate>
		<dc:creator>nerwin hernando</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA["C# Windows Service MessageQueue"]]></category>

		<guid isPermaLink="false">http://lookdit.wordpress.com/?p=137</guid>
		<description><![CDATA[I would like to share some information on how to use Message Queue in C#. I have this windows service which is created in C#. It has a message queue that listens for some data. But after I started the service, I received an exception. The service stopped and I had to search for the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=137&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I would like to share some information on how to use Message Queue in C#. I have this windows service which is created in C#. It has a message queue that listens for some data. But after I started the service, I received an exception.<br />
The service stopped and I had to search for the cause. In this document I will described what I did.</p>
<table>
<tr>
<td>
1. I opened the event viewer (eventvwr.msc). Then searched for the service.<br />
<div id="attachment_141" class="wp-caption alignleft" style="width: 490px"><a href="http://lookdit.files.wordpress.com/2010/01/1.jpg"><img class="size-full wp-image-141" title="Event Viewer" src="http://lookdit.files.wordpress.com/2010/01/1.jpg?w=497" alt=""   /></a><p class="wp-caption-text">Event Viewer</p></div>
</td>
</tr>
<tr>
<td>
2. I opened the Event Properties and it states that the service started successfully.<br />
<div id="attachment_142" class="wp-caption alignleft" style="width: 414px"><a href="http://lookdit.files.wordpress.com/2010/01/1-11.jpg"><img class="size-full wp-image-142" title="Event Properties" src="http://lookdit.files.wordpress.com/2010/01/1-11.jpg?w=497" alt=""   /></a><p class="wp-caption-text">Event Properties 1</p></div>
</td>
</tr>
<tr>
<td>
3.  I also checked on the other one which define the exception that occurred.<br />
<div id="attachment_146" class="wp-caption alignleft" style="width: 414px"><a href="http://lookdit.files.wordpress.com/2010/01/1-2.jpg"><img class="size-full wp-image-146" title="Event Properties 2" src="http://lookdit.files.wordpress.com/2010/01/1-2.jpg?w=497" alt=""   /></a><p class="wp-caption-text">Event Properties 2</p></div>
</td>
</tr>
<tr>
<td>
4. I ran the debugger and it pointed me to the line where the exception happened.<br />
<div id="attachment_143" class="wp-caption alignleft" style="width: 409px"><a href="http://lookdit.files.wordpress.com/2010/01/22.jpg"><img class="size-full wp-image-143" title="Exception occured" src="http://lookdit.files.wordpress.com/2010/01/22.jpg?w=497" alt=""   /></a><p class="wp-caption-text">Exception</p></div>
</td>
</tr>
<tr>
<td>
5. It tells that the Message Queue does not exist.<br />
<div id="attachment_151" class="wp-caption alignleft" style="width: 490px"><a href="http://lookdit.files.wordpress.com/2010/01/32.jpg"><img class="size-full wp-image-151" title="MessageQueue Exception" src="http://lookdit.files.wordpress.com/2010/01/32.jpg?w=497" alt=""   /></a><p class="wp-caption-text">MessageQueue Exception</p></div>
</td>
</tr>
<tr>
<td>
6. This is the Message Queue in my configuration file.<br />
<div id="attachment_152" class="wp-caption alignleft" style="width: 490px"><a href="http://lookdit.files.wordpress.com/2010/01/41.jpg"><img class="size-full wp-image-152" title="Message Queue Name" src="http://lookdit.files.wordpress.com/2010/01/41.jpg?w=497" alt=""   /></a><p class="wp-caption-text">Message Queue Name in Config File</p></div>
</td>
</tr>
<tr>
<td>
7. I found out that this queue should be created manually in the Computer Management-&gt;Services and Applications-&gt;Message Queuing.? <a href="http://www.codeguru.com/columns/dotnet/article.php/c4241/">This</a> is the site where I found the solution.<br />
<div id="attachment_153" class="wp-caption alignleft" style="width: 490px"><a href="http://lookdit.files.wordpress.com/2010/01/51.jpg"><img class="size-full wp-image-153" title="Computer Management Image 1" src="http://lookdit.files.wordpress.com/2010/01/51.jpg?w=497" alt=""   /></a><p class="wp-caption-text">Computer Management Image 1</p></div>
</td>
</tr>
<tr>
<td>
8. Right Click on the &#8220;Private Queues&#8221; item. Then select New-&gt;Private Queue.<br />
<div id="attachment_154" class="wp-caption alignleft" style="width: 452px"><a href="http://lookdit.files.wordpress.com/2010/01/71.jpg"><img class="size-full wp-image-154" title="New Private Queue" src="http://lookdit.files.wordpress.com/2010/01/71.jpg?w=497" alt=""   /></a><p class="wp-caption-text">New Private Queue</p></div>
</td>
</tr>
<tr>
<td>
9. Then enter the name for the Message Queue.. (e.g &#8220;RegistrationQueue&#8221;). I clicked on the Transaction check box.<br />
<div id="attachment_155" class="wp-caption alignleft" style="width: 489px"><a href="http://lookdit.files.wordpress.com/2010/01/8.jpg"><img class="size-full wp-image-155" title="Registration Queue" src="http://lookdit.files.wordpress.com/2010/01/8.jpg?w=497" alt=""   /></a><p class="wp-caption-text">Registration Queue</p></div><br />
10. Restart the service. The service is now running.<br />
- FIN
</td>
</tr>
</table>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lookdit.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lookdit.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lookdit.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lookdit.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lookdit.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lookdit.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lookdit.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lookdit.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lookdit.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lookdit.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lookdit.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lookdit.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lookdit.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lookdit.wordpress.com/137/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lookdit.wordpress.com&amp;blog=8570304&amp;post=137&amp;subd=lookdit&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lookdit.wordpress.com/2010/01/27/messagequeue-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d0c7af6cb775f23abf74e9696dc57af8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nerwinc0hernando</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/01/1.jpg" medium="image">
			<media:title type="html">Event Viewer</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/01/1-11.jpg" medium="image">
			<media:title type="html">Event Properties</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/01/1-2.jpg" medium="image">
			<media:title type="html">Event Properties 2</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/01/22.jpg" medium="image">
			<media:title type="html">Exception occured</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/01/32.jpg" medium="image">
			<media:title type="html">MessageQueue Exception</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/01/41.jpg" medium="image">
			<media:title type="html">Message Queue Name</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/01/51.jpg" medium="image">
			<media:title type="html">Computer Management Image 1</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/01/71.jpg" medium="image">
			<media:title type="html">New Private Queue</media:title>
		</media:content>

		<media:content url="http://lookdit.files.wordpress.com/2010/01/8.jpg" medium="image">
			<media:title type="html">Registration Queue</media:title>
		</media:content>
	</item>
	</channel>
</rss>
