<p><em>This post first appeared on my old C++ blog. You might have seen it before.</em></p>
<p>These are just a couple of notes for some neat tips and tricks I’ve discovered over the years when using <a href="http://www.boost.org/doc/libs/1_56_0/libs/test/doc/html/index.html">Boost.Test</a>. They may not be all that useful to everybody else but they’re the ones I tend to forget about and then end up rediscovering. I’m using most of these with recent versions of Boost and these were tested with 1.54.</p>
<p>Quick hack/warning for those using an alternative command line processor like <a href="https://jpsoft.com/tccle-cmd-replacement.html">TCC</a> and also use Xoreax’ <a href="https://www.incredibuild.com/">Incredibuild</a> for distributed builds. Incredibuild is awesome, by the way, and if you have a larger C++ project that takes a long time to build, you should use it. And no, I’m not getting paid or receive free stuff for writing that.</p>
<p>I recently came across a discussion on LinkedIn where someone had run into memory related undefined behaviour. This prompted me to write this post as it’s a common, subtle and often not very well understood bug that’s easily introduced into C++ code.</p>
<p>As VS2012’s C++ compiler doesn’t support “true” variadic templates, the new runtime library classes that use variadic templates are implemented using macro magic behind the scenes. In order to get the “variadic” templates to accept more than the default of five parameters, you’ll have to set _VARIADIC_MAX to the desired maximum number of parameters (between five and ten).</p>
<p>I’ve finally corrected some of the mistakes that I published in my <a href="https://www.lonecpluspluscoder.com/2012/09/22/i-dont-want-to-see-another-using-namespace-xxx-in-a-header-file-ever-again/">blog post about the misuse of using namespace xxx</a>. My apologies for taking this long.</p>
<p>I was profiling some code a while ago that makes extensive use of boost::variant and one of the lessons from the profiler run was that boost variants appear to be fairly expensive to construct and copy.</p>
<p>There, I’ve said it. No tiptoeing around.</p>
<p>After all the brouhaha over Visual Studio 2012 not being able to build executables for Windows XP, it looks like Microsoft has reconsidered:</p>
<p>… make sure that you have removed all dependencies on the project that you are about to remove before you remove the project from the solution.</p>