Dr. Dobb's Blogs http://www.drdobbs.com//author/6833 Dr. Dobb's Copyright 2013, United Business Media. en-us Conversion Constructors and Subtle Dangers http://www.drdobbs.com/cpp/conversion-constructors-and-subtle-dange/229300256 Pretty much every old C++ war-horse knows to use the <code/>explicit</code> keyword when defining constructors with one only (non-defaulted) parameter. Even so, the subtleties of what can go wrong wit... Sun, 23 Jan 2011 23:45:12 -0500 Welcome to 2011 http://www.drdobbs.com/architecture-and-design/welcome-to-2011/229300259 I want to wish the Dr Dobb's community a (belated) happy new year, and promise that I'll be more regular in my contributions over the coming 12 months. In 2011 I'm hoping to finish various tasks that... Sun, 23 Jan 2011 01:28:13 -0500 Forgotten Headers and Strange Warnings http://www.drdobbs.com/cpp/forgotten-headers-and-strange-warnings/228701022 I recently had one of those oh-oh moments where you find yourself suddenly abandoned by the wisdom and experience of decades of programming. As usual the explanation was blindingly obvious after the fact, but it was harder than you might expect to get there, in part because GCC is ever so helpful, and C is often not helpful enough. Sat, 30 Oct 2010 20:15:00 -0400 Seat for Life http://www.drdobbs.com/architecture-and-design/seat-for-life/228700639 In 2000 I purchased my office chair. A couple of weeks ago it broke. I was pessimistic about getting it fixed quickly/easily/under-warranty. I couldn't have been more wrong. Tue, 19 Oct 2010 22:34:42 -0400 Hairshirt on backwards http://www.drdobbs.com/cpp/hairshirt-on-backwards/228700029 In order to make big things easy for myself when programming, I do all manner of small things to make it harder. I call this Hairshirt Programming, and have been espousing its virtues since I first coined the phrase in <a href="http://www.imperfectcplusplus.com/"><em>Imperfect C++</em></a>. Today I had it on backwards, and was caught out. Fri, 24 Sep 2010 15:00:00 -0400 0 is octal! http://www.drdobbs.com/cpp/0-is-octal/228700312 I'm currently enhancing one of my source analysis tools and have had occasion to revisit the parsing of numeric literals in C, C++, C#, D and Java. Working my way through the requisite parts of the C and C++ standards I learned that the literal <code>0</code> is actually an octal, something that's probably not that widely known. Thu, 23 Sep 2010 03:10:00 -0400 Testing standard output exhaustion http://www.drdobbs.com/cpp/testing-standard-output-exhaustion/228700854 While writing the latest instalment of <a href="http://quality-matters-to.us/"><em>Quality Matters</em></a> I've needed to be able to demonstrate exhaustion of a process's standard output stream. Such a thing is possible, but it's a lot harder to achieve than you might think. This is the story of how I achieved it. </p> Sun, 19 Sep 2010 18:00:00 -0400 Watch out for operator alternates http://www.drdobbs.com/cpp/watch-out-for-operator-alternates/228700429 I'm doing some examples for the next instalment of my <a href="http://quality-matters-to.us/"><em>Quality Matters</em></a> column for ACCU's Overload, and got caught by a head-scratcher that someone who's been programming C and C++ for as long as I have has no right to forget. See if you can spot the problem. </p> Tue, 14 Sep 2010 18:30:23 -0400 Console width gotcha http://www.drdobbs.com/windows/console-width-gotcha/228700320 Just when I thought it was safe for me to be let out to program in public, I go and embarrass myself yet again. It's the usual story: write library function that's not readily amenable to automated testing; perform scratch tests; get inappropriate level of confidence; program confidently; build application; observe weird behaviour; spend day tracking it down; slap self on head for stupidity ... Thu, 09 Sep 2010 15:35:00 -0400 Programming: Sudoku With a Time Limit? http://www.drdobbs.com/windows/programming-sudoku-with-a-time-limit/228700595 I've been searching for a metaphor for programming, to help explain to my sons the curiosity, the intellectual satisfaction, the maintenance of multiple simultaneous concepts in the brain, the tremendous importance of experience and of metaphor, and the occasional intense pressure of what it is I do for a living. </p> Tue, 07 Sep 2010 13:15:58 -0400 memset() Considered Harmful http://www.drdobbs.com/cpp/memset-considered-harmful/228701396 I've recently enhanced the <a href="http://www.pantheios.org/"><strong>Pantheios</strong></a> logging API library for full wide-string support, and found that hubris still walks tall in my coding practice!</p> Sun, 20 Jun 2010 15:34:32 -0400 The Mutable Comprehension of const http://www.drdobbs.com/cpp/the-mutable-comprehension-of-const/228700195 I don't know about you, but I get all future-shocked when trying to express or understand concepts where language is used ambiguously. Unfortunately, even after all these years, it seems that the use of <code>const</code> as a modifier of pointer/reference types in C and C++ can cause confusion. Sat, 05 Jun 2010 19:59:59 -0400 FastFormat's format_iterator in Dr. Dobb's http://www.drdobbs.com/cpp/fastformats-formatiterator-in-dr-dobbs/228700157 The design and implementation of the <strong>FastFormat</strong> library's <code>format_iterator()</code> component features in my recent article published in <strong>Dr. Dobb's</strong>. In this post, I'll provide tutorial information and links to additional resources for any interested readers.</p> Wed, 02 Jun 2010 15:02:16 -0400 Superfluous Curly Braces as Semantic Guides? http://www.drdobbs.com/cpp/superfluous-curly-braces-as-semantic-gui/228700061 Working today I noticed that I tend to use use curly-braces to rank different levels of semantic operations. Never before having consciously thought about the rules applied, I thought it fit to discuss it with you, gentle readers, and see whether I'm not alone. Sat, 22 May 2010 12:12:43 -0400 Recursive search examples, pt3: C++ http://www.drdobbs.com/windows/recursive-search-examples-pt3-c/228701645 In two previous posts, I looked at implementations of a simple recursive-search task, implemented first in C# and then in C. In this post I'll examine how to write the same algorithm in C++, and continue the comparative performance analysis. </p> Wed, 28 Apr 2010 14:00:00 -0400 Beware C2471 http://www.drdobbs.com/cpp/beware-c2471/228700983 As <a href="http://www.drdobbs.com/blog/archives/2010/02/still_be_explic.html">I mentioned previously</a> I&#39;m multitasking between three clients at the moment, two of whose projects are based primarily around C++. It&#39;s interesting seeing the differences between all the languages, programming styles, and tools, involved. For a <em>consultant</em> - horrid word - it&#39;s a refreshing and enlightening experience. </p> However, it can also be an extremely frustrating one when the tools employed let you down. Today&#39;s work involves porting a GCC/Lex/Yacc codebase to Visual C++ 9 (aka Visual Studio 2008). And VC++ decided to bite me. </p> Mon, 08 Feb 2010 19:00:00 -0500 (Still) be explicit to avoid those array/pointer decay ambiguities http://www.drdobbs.com/cpp/still-be-explicit-to-avoid-those-arraypo/228701363 I&#39;m multitasking between three clients at the moment, two of whose projects are based primarily around C++. It&#39;s interesting seeing the differences between all the languages, programming styles, and tools, involved. For a <em>consultant</em> - horrid word - it&#39;s a refreshing and enlightening experience. </p> Although there is a <a href="http://en.wikipedia.org/wiki/C99">C standard</a> and a <a href="http://en.wikipedia.org/wiki/C%2B%2B03">C++ standard</a>, there are also different degrees of support for the standards by different compilers, not to mention some subtle (and some not-so-subtle) extensions and non-standard features. Consequently, there are myriad ways in which competent programmers can find themselves mired in incompatibilities. And that can even happen when they&#39;re adhering to the standard(s)! </p> Fri, 05 Feb 2010 19:00:00 -0500 "I don't get it. Whoosh! Next." http://www.drdobbs.com/architecture-and-design/i-dont-get-it-whoosh-next/228701072 A fascinating coincidence today: I was watching Billy Connolly participating in (his wife) Pamela Connolly&#39;s <strong>Shrink Wrap</strong> programme of psychological interviews. At the same time, I&#39;m wrestling with Office 2007&#39;s perverse new user interface paradigm. And Windows 7. And my iPhone. </p> Tue, 12 Jan 2010 19:00:00 -0500 Hungarian notation alive in .NET? http://www.drdobbs.com/windows/hungarian-notation-alive-in-net/228701270 I think - well, I hope, anyway! - that the battle for <a href="http://en.wikipedia.org/wiki/Hungarian_notation">Hungarian Notation</a> has been resolved for most programmers. Nonetheless, it seems to have left more than a faint trace &nbsp; in the .NET world. Is this a good thing? Can it be avoided? </p> Mon, 14 Dec 2009 19:00:00 -0500 Why does Bing think I've gone home? http://www.drdobbs.com/architecture-and-design/why-does-bing-think-ive-gone-home/228700123 In the interests of fairness - not to mention my dislike of unchallenged monopolies - I decided to give <a href="http://www.bing.com/">Bing</a> a chance. Only problem is, it thinks I&#39;ve gone home. Could it be my grammar?</p> Mon, 23 Nov 2009 19:00:00 -0500 Recursive search examples, pt2: C http://www.drdobbs.com/cpp/recursive-search-examples-pt2-c/228701742 In my <a href="http://www.drdobbs.com/blog/archives/2009/11/recursive_searc.html">previous post</a>,I started looking at a simple recursive-search implementation in C#,using <a href="http://www.recls.net/">recls 100%.NET</a>.I&#39;d next planned to look at the equivalent C++. However,because the recls (C/C++) library is still in-flux - between versions 1.8 and 1.9 - presenting a C++ example right now will require either using the 1.8 C++ API, which is a little tired, or using the 1.9 C++ API, which is not yet available in the public-domain. So, my current plan is to present an example using recls&#39; C API, while I get the 1.9 released; hopefully in a week or two I&#39;ll be able complete the story with the C++ implementation.</p> Sun, 22 Nov 2009 19:00:00 -0500 Recursive search examples, pt1: C# http://www.drdobbs.com/windows/recursive-search-examples-pt1-c/228701244 In light of <a href="http://www.ddj.com/cpp/221900083">my recent article on recls 100% .NET</a>, I thought I&#39;d do some bits on the <strong>recls</strong> library: the <a href="http://www.recls.org/">C/C++ version</a>, and the new <a href="http://www.recls.net/">.NET version</a>. </p> First up, let&#39;s write a utility that, say, reports the number of C# source files in/under the current directory, excluding the ubiquitous Properties/AssemblyInfo.cs, and reports on the total size of all. We&#39;ll write it in C# using <strong>recls 100%.NET</strong> and in C &amp; C++ using <strong>recls</strong>. As you&#39;ll see, we see a pretty obvious difference in development effort, which probably isn&#39;t a surprise. What is a surprise, given the application domain, is there&#39;s a substantial performance difference, which I <em>think</em> might be due to the .NET runtime. </p> Thu, 19 Nov 2009 19:00:00 -0500 .NET Collection Enumeration Performance, part 1 http://www.drdobbs.com/architecture-and-design/net-collection-enumeration-performance-p/228700078 I&#39;m investigating the performance of various ways of enumerating collections in .NET, and have some results you might be interested in. The firstbunch concern enumeration of collections (of strings). </p> Wed, 04 Nov 2009 19:00:00 -0500 Introductions http://www.drdobbs.com/cpp/introductions/228701657 As new boy on the block, I think it behoves me to give a little introduction: my experience, my interests, and what subjects I intend to cover in this forum.</p> The bio at the top of this forum describes much of what you need to know about my experience, so I won&#39;t bang on too much more about that. Professionally, I enjoy leaving behind happy clients, and in particular I take it as a point of pride to build systems that don&#39;t break. Not always easy to achieve, of course. Although I primarily work for <a href="http://synesis.com.au/clients.html">clients</a> within Australia, I do occasional work with overseas <a href="http://synesis.com.au/clients.html">clients</a> . The common factor between them all is that they want reliable software.</p> <strike>&nbsp;Unprofessionally</strike> (that doesn&#39;t sound too good, does it?) <em>Non-commercially</em>, my interests are pretty cleanly split into two:</p> Mon, 02 Nov 2009 19:00:00 -0500