<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>The lone C++ coder's blog - C++ programming</title>
    <link>http://codeblog.bsdninjas.co.uk/</link>
    <description>Diary of a supposedly experienced C++ developer</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4.1 - http://www.s9y.org/</generator>
    <pubDate>Sat, 06 Feb 2010 12:18:47 GMT</pubDate>

    <image>
        <url>http://codeblog.bsdninjas.co.uk/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: The lone C++ coder's blog - C++ programming - Diary of a supposedly experienced C++ developer</title>
        <link>http://codeblog.bsdninjas.co.uk/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>A neater way of handling common exceptions</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/142-A-neater-way-of-handling-common-exceptions.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/142-A-neater-way-of-handling-common-exceptions.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=142</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=142</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;p&gt;In a sense, this post is a follow-up to the &lt;a href=&quot;http://codeblog.bsdninjas.co.uk/index.php?/archives/137-The-little-exception-shop-of-horrors.html&quot;&gt;&quot;little exception shop of horrors&quot;&lt;/a&gt; below. I believe the idea with dumping all the exception
handling code into a header file was to avoid code duplication. No, I didn&#039;t write that code - I inherited it, which was bad enough. Sound
idea but bad execution, plus of course you still have code duplication as the preprocessor will do the work for you. Ah well, at
least to don&#039;t have to type the code in yourself multiple times. I couldn&#039;t help but think that there &lt;em&gt;must&lt;/em&gt; be a better way.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://codeblog.bsdninjas.co.uk/index.php?/archives/142-A-neater-way-of-handling-common-exceptions.html#extended&quot;&gt;Continue reading &quot;A neater way of handling common exceptions&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Thu, 04 Feb 2010 21:38:00 +0000</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/142-guid.html</guid>
    
</item>
<item>
    <title>The little exception shop of horrors</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/137-The-little-exception-shop-of-horrors.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/137-The-little-exception-shop-of-horrors.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=137</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=137</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;p&gt;Exceptions - as we probably all agree - are generally a good thing as
they allow us to separate the error handling from the general flow of
control inside a program and also enable us to handle errors at the
most appropriate point, which might be quite far removed from the
source of the exception.&lt;/p&gt;
&lt;p&gt;Imagine my surprise when I came across the following gem that was
almost worthy of the Daily WTF:&lt;/p&gt;
&lt;pre&gt;
&lt;span style=&quot;color: #a020f0;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #5f9ea0;&quot;&gt;std&lt;/span&gt;::&lt;span style=&quot;color: #228b22;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #b8860b;&quot;&gt;ex&lt;/span&gt;) {
  &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Do something horrible with the exception
&lt;/span&gt;}
 &lt;span style=&quot;color: #a020f0;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #a020f0;&quot;&gt;const&lt;/span&gt; &lt;span style=&quot;color: #228b22;&quot;&gt;char&lt;/span&gt; *&lt;span style=&quot;color: #b8860b;&quot;&gt;ex&lt;/span&gt;) {
   &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Eh?
&lt;/span&gt; }
 &lt;span style=&quot;color: #a020f0;&quot;&gt;catch&lt;/span&gt; (&lt;span style=&quot;color: #228b22;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #b8860b;&quot;&gt;i&lt;/span&gt;) {
   &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Uh oh
&lt;/span&gt; }
&lt;/pre&gt;
&lt;p&gt;I guess in some circles, being able to throw any sort of POD or
object as an exception is considered a good thing. It&#039;s not necessarily considered to be a good thing
when I&#039;m around...&lt;/p&gt;&lt;p&gt;For the moment we&#039;ll also gloss over the advisability of catching exceptions by value. That doesn&#039;t mean I&#039;m condoning that sort of coding.&lt;/p&gt;
&lt;p&gt;But wait, it gets better. You thought that the code snippet above
was part of a larger chunk of code that I omitted, didn&#039;t you? Well, it
actually wasn&#039;t - it was all parked in a header file.&lt;/p&gt;
&lt;p&gt;In order to avoid duplication of code - always a worthy goal - the
above header file include wherever needed, so at least one of the
files was full of code like this:&lt;/p&gt;
&lt;pre&gt;
&lt;span style=&quot;color: #228b22;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;doSomething&lt;/span&gt;() {
  &lt;span style=&quot;color: #a020f0;&quot;&gt;try&lt;/span&gt; {
    &lt;span style=&quot;color: #b22222;&quot;&gt;// &lt;/span&gt;&lt;span style=&quot;color: #b22222;&quot;&gt;Lots of processing that might throw
&lt;/span&gt;  }
&lt;span style=&quot;color: #da70d6;&quot;&gt;#include&lt;/span&gt; &lt;span style=&quot;color: #bc8f8f;&quot;&gt;&quot;catch_clauses.H&quot;&lt;/span&gt;
}
&lt;/pre&gt;
&lt;p&gt;Pass the Stroustrup, I need to refactor a developer or three...&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Sun, 11 Oct 2009 09:40:00 +0100</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/137-guid.html</guid>
    
</item>
<item>
    <title>Using pantheios to log inside a C++ JNI DLL</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/134-Using-pantheios-to-log-inside-a-C++-JNI-DLL.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/134-Using-pantheios-to-log-inside-a-C++-JNI-DLL.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=134</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=134</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;P&gt;I recently had to come up with a logging solution for a JNI DLL/shared library that was written in C++ and is providing the data translation layer between Java and the native libraries. As usual, some logging was required to aid fault finding in a production environment, if necessary. A quick survey of the state of C++ logging showed that not a lot had changed since I last looked at logging libraries for C++. In fact, a lot of them seem to have survived unchanged for several years. I&#039;m not sure if that is a good thing and a sign of maturity or a sign of &quot;making do&quot;. Eventually I settled on &lt;a href=&quot;http://www.pantheios.org/&quot;&gt;pantheios&lt;/a&gt; as it offered a bunch of features that were crucial for this application. The major one was that it is extremely modular and will only link in the parts you really need. I consider this a major advantage over the more monolithic libraries that pull in all their functionality all the time, especially when you link them in as a static library (yes, log4cxx, I&#039;m looking at you). Linking in the logging library as a static library was a necessity to avoid conflicts with other libraries that are being used in the same process.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://codeblog.bsdninjas.co.uk/index.php?/archives/134-Using-pantheios-to-log-inside-a-C++-JNI-DLL.html#extended&quot;&gt;Continue reading &quot;Using pantheios to log inside a C++ JNI DLL&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Thu, 24 Sep 2009 20:44:00 +0100</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/134-guid.html</guid>
    
</item>
<item>
    <title>Some clarifications regarding last week's anti-VC6 rant</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/133-Some-clarifications-regarding-last-weeks-anti-VC6-rant.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/133-Some-clarifications-regarding-last-weeks-anti-VC6-rant.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=133</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=133</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;p&gt;This post started out as a comment to &lt;a href=&quot;http://www.lenholgate.com/archives/000868.html&quot;&gt;Len Holgate&#039;s post referencing my anti-VC6 rant&lt;/a&gt;. The comment got a little out of hand size wise so I&#039;ve decided to turn it into a separate blog post. I think I mixed a couple of issues together that should been separated better but weren&#039;t - after all, my blog post was more of a rant.&lt;/p&gt;

&lt;p&gt;First, if your client or employer is maintaining an existing system and the system is in maintenance mode only, we&#039;re talking about a bug fix or a small enhancement then it doesn&#039;t make sense to upgrade the compiler. That&#039;s what I was referring to as a system that is &quot;on life support&quot;. Yes, it goes against the grain for me personally as a software engineer who likes to improve software but the effort spent on making the transition does not make sense from a business perspective.&lt;/p&gt;

&lt;p&gt;What I do take issue with is when you are developing a new system or are working on a large refactor of an existing system that is in &quot;embrace and extend mode&quot;, and for whatever reason the client or employer decrees that it shall be written using VC6. That&#039;s where the penalties come in and that is where the technical debt builds up at the start of a new project or at the exact point in time when you should be addressing the debt instead of adding to it.&lt;/p&gt;

&lt;p&gt;The understanding of C++ and the use of its multi-paradigm nature has changed since VC6 was released, we have both new programming techniques and new libraries that (should) improve the quality of the code, its expressiveness and programmer productivity. The prime example of these libraries and the one I was thinking of when writing the rant of course is Boost. The earliest MS compiler they test against in 1.40 is VC7.1 aka VS2003 which is certainly a big improvement over VC6.&lt;/p&gt;

&lt;p&gt;Yes, VC6 is likely to create smaller executables and build them faster. C++ compilers certainly are not getting any faster and long compile/link times have been a problem on projects I worked on. Shorter build times and especially smaller executables can be a benefit depending on your particular use case. A lot of the projects I worked on in the recent past are maths heavy and the calculations are performance critical. For these projects, an compiler that has an optimizer which can squeeze a 5% performance improvement out of the existing code one a modern CPU at the expense of 20% larger code is a no brainer. In at least one case it was cheaper to buy the Intel compiler to get better performance instead of putting more engineering time into performance improvements.&lt;/p&gt;

&lt;p&gt;Yes, developers like shiny new tools and yes, I&#039;ve worked with developers who considered GCC&#039;s CVS HEAD the only compiler that was recent enough to complement their awesomeness. This is &lt;em&gt;not&lt;/em&gt; something I generally agree with although I did update my own copy of Visual Studio from 2003 to 2008 (yes, I did skip 2005) when that version came out simply because it was so much better than its predecessors.&lt;/p&gt;

&lt;p&gt;I still think that by insisting on the usage of tools that are positively ancient, programmers get needlessly hobbled and it is part of our job as programmers who care about what they do to educate the people who make these decisions as to why they aren&#039;t necessarily good from an engineering point of view. I don&#039;t think any of the Java programmers I work with would put up with having to work using &lt;a href=&quot;http://en.wikipedia.org/wiki/Java_version_history#J2SE_1.2_.28December_8.2C_1998.29&quot;&gt;Java 1.2&lt;/a&gt; and forego the improvements both in the language and in the available libraries, yet C++ programmers are regularly asked to do exactly that.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;zemanta-pixie&quot;&gt;&lt;img class=&quot;zemanta-pixie-img&quot; alt=&quot;&quot; src=&quot;http://img.zemanta.com/pixy.gif?x-id=21e536c8-fe56-8ce6-a17d-41a72a5bd8fb&quot; /&gt;&lt;/div&gt; 
    </content:encoded>

    <pubDate>Wed, 09 Sep 2009 22:02:28 +0100</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/133-guid.html</guid>
    
</item>
<item>
    <title>Why oh why do people insist on using compilers that are way out of date?</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/123-Why-oh-why-do-people-insist-on-using-compilers-that-are-way-out-of-date.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/123-Why-oh-why-do-people-insist-on-using-compilers-that-are-way-out-of-date.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=123</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=123</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;p&gt;Why are so many companies hobbling their programmers with positively ancient and often positively crappy tools? For once I&#039;m not ranting about companies that are too cheap to provide their C++ programmers with important tools like profilers and leak detectors - the usual &quot;if these were important, the tool vendor would include them&quot; argument, but the one tool right at the heart of the matter. The one none of us can work without in C++ space. I am, of course, talking about the compiler.&lt;/p&gt;
&lt;p&gt;One of my personal pet hates is the number of projects that are still using Visual C++ 6 - for $DEITY&#039;s sake, that compiler was released back in 1998 and it wasn&#039;t that good back then. Microsoft has since released &lt;i&gt;four&lt;/i&gt; new versions of their C++ compiler and a fifth is due very soon. Each one of them is better and more importantly,  more standard compliant than its predecessor. All have benefited enormously from people trying to push the boundaries of what you can do with C++ in the past eleven years. Oh, and &lt;a href=&quot;http://blogs.msdn.com/yvesdolc/archive/2004/08/22/218583.aspx&quot;&gt;mainstream support for the compiler ended years ago&lt;/a&gt;, but who&#039;s counting? Yet companies still insist on using this outdated piece of &amp;lt;censored&amp;gt;, depriving their programmers of the ability to use more modern C++ techniques that often make for a safer programming environment. &lt;/p&gt;
&lt;p&gt;If your code doesn&#039;t build with a modern, standard compliant compiler and you&#039;re not about to switch off the life support for your project (just about the only justification IMHO for working with ancient tools), the go ahead and get it to compile on the newer version of the compiler. Postponing the conversion will only add to your technical debt until that gets to the point where you, well, switch off life support...&lt;p/&gt; 
    </content:encoded>

    <pubDate>Wed, 02 Sep 2009 21:31:00 +0100</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/123-guid.html</guid>
    
</item>
<item>
    <title>Using polymorphism with boost::shared_ptr</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/118-Using-polymorphism-with-boostshared_ptr.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/118-Using-polymorphism-with-boostshared_ptr.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=118</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=118</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;p&gt;I&#039;m currently in the final stages of converting a library from using raw
pointers to using boost::shared_ptr. This is mainly done to resolve
issues with pointer ownership rather than the outright prevention of
memory leaks, but the latter is a nice side effect of the former.&lt;/p&gt;
&lt;p&gt;The one problem that I ran into during this work was that the
library and its clients make rather heavy use of polymorphism. Of course
in 99% of the code that was fine as the objects were accessed through
pointers to base classes, but the last 1% was causing problems because
that part of the code contained lots of dynamic_cast statements. As these classes unfortunately needed to know the exact type
they were dealing with, there was no easy way around the use of these idioms, either. It probably isn&#039;t news to most of the people
reading this blog that dynamic_cast and boost::shared_ptr don&#039;t play
that nicely but I stepped right into that.&lt;/p&gt;
&lt;p&gt;The main issue is, unsurprisingly, that taking a pointer that is held
inside a boost::shared_ptr, dynamic_casting it down the hierarchy and
then stuffing it into another boost::shared_ptr is a good way to ensure
double deletion. Oops. So, if you see the following code you better get
the debugger out...&lt;/p&gt;
&lt;code&gt;
&lt;pre&gt;

   boost::shared_ptr&amp;lt;A&amp;gt; something(new A(blah));
   ...
   boost::shared_ptr&amp;lt;B&amp;gt; something_else(dynamic_cast&amp;lt;B&amp;gt;(something.get()));

&lt;/pre&gt;
&lt;/code&gt;

&lt;p&gt;So far so bad, but I couldn&#039;t believe that something with a flaw that
   obvious would be in the boost libraries. And of course, there is a
   way around this - boost provides alternatives to the four C++ casts
   with similar names that work on boost::shared_ptrs. You can find
   these alternatives - which are really just wrappers around the C++
   casts, but designed to work with the boost smart pointers - in the
   include file &lt;a
   href=&quot;http://www.boost.org/doc/libs/1_39_0/libs/smart_ptr/pointer_cast.html&quot;&gt;boost/pointer_cast.hpp.&lt;/a&gt;. If you&#039;re using smart pointers because you need polymorphic behaviour of, say, items stored in standard C++ containers, have a look at this page right now. If you don&#039;t have the time or inclination to check the linked document right now, the management summary is: &quot;The next time someone tells you that you can&#039;t use
   boost:.shared_ptr with dynamic_cast, point them in the direction of
   boost::dynamic_pointer_cast&quot;. Using boost::dynamic_pointer_cast would change the above example to:&lt;/p&gt;

&lt;code&gt;
&lt;pre&gt;

   boost::shared_ptr&amp;lt;A&amp;gt; something(new A(blah));
   ...
   boost::shared_ptr&amp;lt;B&amp;gt; something_else =
      boost::dynamic_pointer_cast&amp;lt;B&amp;gt;(something));

&lt;/pre&gt;
&lt;/code&gt;

&lt;p&gt;Problem solved.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 25 May 2009 10:17:29 +0100</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/118-guid.html</guid>
    
</item>
<item>
    <title>Auto-parallelising compiler</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/107-Auto-parallelising-compiler.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/107-Auto-parallelising-compiler.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=107</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=107</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;p&gt;This looks like &lt;a href=&quot;http://www.ddj.com/215901477&quot;&gt;a big step in the right direction&lt;/a&gt;. As Herb Sutter repeatedly pointed out, writing correct parallel programs is a lot harder than writing a correct sequential program so a compiler that can take over part of the work is definitely a good thing.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 25 Mar 2009 11:29:43 +0000</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/107-guid.html</guid>
    
</item>
<item>
    <title>Speeding up Visual C++ compilation by cleaning up the include paths</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/84-Speeding-up-Visual-C++-compilation-by-cleaning-up-the-include-paths.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/84-Speeding-up-Visual-C++-compilation-by-cleaning-up-the-include-paths.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=84</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=84</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;p&gt;As I had hinted at in &lt;a href=&quot;http://codeblog.bsdninjas.co.uk/index.php?/archives/78-Another-hooray-for-emacs.html&quot;&gt;a previous blog post&lt;/a&gt;, I have been working on a script that would substitute unqualified #include directives of the form&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#include &quot;SomeClass.H&quot;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;with #include directives that contain relative include paths of the form&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#include &quot;module_path/SomeClass.H&quot;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Obviously I wasn&#039;t making these changes because of their inherent beauty and style; I had a very simple reason for this endeavour - the build times of the project I am currently working on are rather long. We&#039;re talking 1-2 hours on a decent desktop PC, which does not do much for turnaround times and does inhibit developer productivity somewhat as it&#039;s hard to stay in the zone while watching the compiler do its work. Slowly. One very large module in particular is taking up approximately half the build time in the default build so that was the obvious candidate for improvement.&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://codeblog.bsdninjas.co.uk/index.php?/archives/84-Speeding-up-Visual-C++-compilation-by-cleaning-up-the-include-paths.html#extended&quot;&gt;Continue reading &quot;Speeding up Visual C++ compilation by cleaning up the include paths&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue, 23 Dec 2008 15:46:05 +0000</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/84-guid.html</guid>
    
</item>
<item>
    <title>Checking library versions during build time</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/74-Checking-library-versions-during-build-time.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/74-Checking-library-versions-during-build-time.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=74</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=74</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;i&gt;Management summary&lt;/i&gt;: If your product requires a specific version of an external or internal library, make sure your build breaks if you use a different version...&lt;br /&gt;&lt;br /&gt;Another of these problems that only ever seem to see the light of day - or night, mostly - when you really, really need to get something finished and it&#039;s already 9pm. At that point you&#039;ll hit some strange behaviour that&#039;s hard to reproduce and oddly enough, only shows up on your machine. Trouble is, you need to either work around the bug or fix something nobody else can see.&lt;br /&gt;&lt;br /&gt;At around 2am, when some of your colleagues a lot further East turn up for work and you finally have someone to talk through the problem again, they casually mention that everybody else on the project is using libgbrmpzyyxx version 1.23 whereas you, who joined the team later and was just told to &amp;quot;go download libgbrmpzyyxx&amp;quot; and thus ended up with version 1.31, which contains a few important bugfixes and unfortunately another bug that you just found. Congratulations...&lt;br /&gt;&lt;br /&gt;Of course, &lt;i&gt;everybody knew&lt;/i&gt; that the One True Version of libgbrmpzyyxx was 1.23 but you somehow didn&#039;t managed to acquire that pearl of wisdom via osmosis. Sounds familiar?&lt;br /&gt;&lt;br /&gt;Fortunately, there are some strategies that you can employ to avoid this sort of late-night scenario. &lt;br /&gt;&lt;a href=&quot;http://codeblog.bsdninjas.co.uk/index.php?/archives/74-Checking-library-versions-during-build-time.html#extended&quot;&gt;Continue reading &quot;Checking library versions during build time&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sat, 11 Oct 2008 12:06:00 +0100</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/74-guid.html</guid>
    
</item>
<item>
    <title>Non-intrusive C++ build speedup, part II</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/62-Non-intrusive-C++-build-speedup,-part-II.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/62-Non-intrusive-C++-build-speedup,-part-II.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=62</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=62</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;p&gt;After the success in substantially accelerating the project&#039;s &lt;a href=&quot;http://codeblog.bsdninjas.co.uk/index.php?/archives/39-Non-intrusive-build-speedup-in-Visual-C++-.NET.html&quot;&gt;build time in Visual C++&lt;/a&gt;, I tried the same method on the Linux build using gcc. Unfortunately using the same header file that I used with Visual Studio and the same &#039;force include&#039; technique as suggested by Paolo Bonzini, it appears that the build is actually slower rather than faster. Digging through the GCC documentation so far hasn&#039;t yielded any explanations and I&#039;m still a bit perplexed by the result. Same speed or faster I would have expected but slower?&lt;/p&gt;
&lt;p&gt;Anyway, I&#039;ll keep digging a bit more tomorrow and hopefully will find out what the problem is...&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 26 Feb 2008 22:18:37 +0000</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/62-guid.html</guid>
    
</item>
<item>
    <title>Book recommendation - C++ Coding Standards</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/40-Book-recommendation-C++-Coding-Standards.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/40-Book-recommendation-C++-Coding-Standards.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=40</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=40</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;p&gt;I know, it&#039;s been out a while but as usual I&#039;m a bit behind with my reading. Anyway, if you haven&#039;t read &amp;quot;C++ Coding Standards&amp;quot; by Herb Sutters and Andrei Alexandrescu, get someone to buy you a copy. Actually, if you can&#039;t find someone to buy it for you, go buy it yourself with your own money. Nonewithstanding the fact that the words &amp;quot;coding standard&amp;quot; are considered dirty words by most programmers, this book makes a lot of valid points and more importantly, it makes you &lt;i&gt;think&lt;/i&gt;.&lt;/p&gt;&lt;p&gt;The format is similar to Herb Sutter&#039;s &amp;quot;Exceptional C++&amp;quot; books inasmuch as its topics are arranged in series of short, concise points so the format will feel familiar to a lot of people who are likely to buy the book.&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 07 Jan 2008 21:41:49 +0000</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/40-guid.html</guid>
    
</item>
<item>
    <title>Non-intrusive build speedup in Visual C++ .NET</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/39-Non-intrusive-build-speedup-in-Visual-C++-.NET.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/39-Non-intrusive-build-speedup-in-Visual-C++-.NET.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=39</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=39</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    
&lt;p&gt;Recently I&#039;ve attempted to reduce the build times of a client&#039;s project - said project takes about 90 minutes to build from scratch on a Windows box using Visual Studio .NET (2003). I do realise that one of the easier ways to shorten build times is to simply move to 2005 and make use of its parallel build feature. While that is on the cards, the actual speedup from a move to 2005 isn&#039;t as big as I hoped for. VS2005 does only build (sub)projects in parallel, and two subprojects do take a disproportionate amount of time to build.&lt;/p&gt;&lt;p&gt;This project is cross-platform and as such, I was looking for minimal invasive surgery on the build process to speed up the Windows build process without affecting any of the other platforms. A lot of the Old School ways of improving build times had already been applied - for example, the include guards are checked in the including files to prevent double inclusions (as John Lakos recommended in his book &amp;quot;Large Scale C++ Programming&amp;quot;), almost all headers have include guards and so on.&lt;/p&gt;&lt;p&gt;My first thought - which was anything but minimally invasive - was to add a suitably protected &#039;#pragma once&#039; to all includes. When I did measure the resulting build times I was a bit surprised - on my desktop machine, there was no difference in build time outside the measuring tolerance. On the laptop that I work on when working remotely, there was a measureable acceleration, but we&#039;re still talking in the order of 5%, up to about 8%-9% on a really good run. It seems that VS 2003 is already doing a pretty good job of caching headers, so the difference that #pragma once make seem to show mainly on machines with relatively little RAM and slow harddisks. At this point I went onto another Google spree and found that &lt;a href=&quot;http://www.gamesfromwithin.com/articles/0403/000013.html&quot;&gt;this article on Games From Within&lt;/a&gt; had arrived at the same conclusions. Which left only one obvious way of improving build times and that was by using precompiled headers for the Windows build. And the Windows build only...&lt;/p&gt;&lt;p&gt;The obvious way to use precompiled headers would have been to create a script that iterates over all .cpp files in the project, checks them out from version control and adds the line including the precompileable header. Such a script is not exactly hard to write - depending on the version control system you&#039;re using, you may not even have to check out the files before being able to change them. Nevertheless, this approach very much violated the &#039;minimally invasive&#039; requirement. In other words, I didn&#039;t want to change the source code at all.&lt;/p&gt;&lt;p&gt;
&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://codeblog.bsdninjas.co.uk/index.php?/archives/39-Non-intrusive-build-speedup-in-Visual-C++-.NET.html#extended&quot;&gt;Continue reading &quot;Non-intrusive build speedup in Visual C++ .NET&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Wed, 19 Dec 2007 15:06:00 +0000</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/39-guid.html</guid>
    
</item>
<item>
    <title>A new secret c++ weapon in my arsenal</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/37-A-new-secret-c++-weapon-in-my-arsenal.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/37-A-new-secret-c++-weapon-in-my-arsenal.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=37</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=37</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    
A couple of days ago I finally got around to buying a copy of &lt;a href=&quot;http://www.gimpel.com/&quot;&gt;Gimpel&#039;s PC-Lint&lt;/a&gt; tool. Obviously this is a tool that 99% of the world&#039;s C++ programmers don&#039;t need as they already writing the most perfect code possible, but for those of us who have learned the hard way that they are mere mortals and not masters of their universes, it is a very worthwhile tool.

So far I haven&#039;t done much with it; I just ran it over a couple of files that I was refactoring anyway. Nevertheless I picked up a couple of valid hints about further improvements to the code. As always with lint tools, you need to spent some time tweaking the configuration until it&#039;s &amp;quot;just right&amp;quot; for your project as it&#039;ll drown you in hints and warnings otherwise. Some of these warnings may be utterly irrelevant to your project or outside your control - in my case, I got a ton of warnings from some third-party library header files that I can&#039;t do anything about anyway.

After the configuration, the next step on the agenda is to integrate it with (X)Emacs on Windows so I can lint files directly inside the editor. Guess I&#039;ll have a Google first to see if anybody&#039;s written any code for that yet or if I have to go and &lt;strike&gt;bodge&lt;/strike&gt;build something that abuses compile-mode or similar to accomplish this goal. Good thing I&#039;ve recently bought Peter Seibel&#039;s Practical Common Lisp to refresh my very rusty Lisp skills. 
    </content:encoded>

    <pubDate>Fri, 19 Oct 2007 06:51:32 +0100</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/37-guid.html</guid>
    
</item>
<item>
    <title>Visual C++ 2005 time_t changes</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/31-Visual-C++-2005-time_t-changes.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/31-Visual-C++-2005-time_t-changes.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=31</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=31</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    
&lt;p&gt;&lt;font style=&quot;background-color: rgb(250, 255, 255);&quot;&gt;Over the past couple of days I&#039;ve tried to get a client&#039;s application to build (and then hopefully to work...) on Visual Studio 2005. Most of the problems highlighted by the conversion were fairly trivial and a result of the better standard compliance of the compiler, but the change in the size of time_t caught me out initially.&lt;/font&gt;&lt;/p&gt; &lt;br /&gt;&lt;a href=&quot;http://codeblog.bsdninjas.co.uk/index.php?/archives/31-Visual-C++-2005-time_t-changes.html#extended&quot;&gt;Continue reading &quot;Visual C++ 2005 time_t changes&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Tue, 07 Aug 2007 06:55:00 +0100</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/31-guid.html</guid>
    
</item>
<item>
    <title>A more up-to-date comparison of C++ unit testing frameworks</title>
    <link>http://codeblog.bsdninjas.co.uk/index.php?/archives/29-A-more-up-to-date-comparison-of-C++-unit-testing-frameworks.html</link>
            <category>C++ programming</category>
    
    <comments>http://codeblog.bsdninjas.co.uk/index.php?/archives/29-A-more-up-to-date-comparison-of-C++-unit-testing-frameworks.html#comments</comments>
    <wfw:comment>http://codeblog.bsdninjas.co.uk/wfwcomment.php?cid=29</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://codeblog.bsdninjas.co.uk/rss.php?version=2.0&amp;type=comments&amp;cid=29</wfw:commentRss>
    

    <author>nospam@example.com (Timo Geusch)</author>
    <content:encoded>
    &lt;p&gt;While there are a lot of C++ unit testing frameworks out there - sometimes you get the impression that there are nearly as many as there are logging libraries and string classes - there don&#039;t seem to be that many well-researched comparisons of those frameworks.&lt;/p&gt;&lt;p&gt;That said, Chris Main published &lt;a href=&quot;http://accu.org/index.php/journals/1326&quot;&gt;an article&lt;/a&gt; in Overload comparing a few more modern frameworks. Worth reading in my opinion, even if it&#039;s just to keep up with what&#039;s going on.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Thu, 24 May 2007 07:58:31 +0100</pubDate>
    <guid isPermaLink="false">http://codeblog.bsdninjas.co.uk/index.php?/archives/29-guid.html</guid>
    
</item>

</channel>
</rss>