Expert Texture Home Contact me About Subscribe Digipede Connect on LinkedIn rwandering on Twitter rwandering on FriendFeed

The blogged wandering of Robert W. Anderson

Perils of #define

A couple of years ago, I wrote Three deficiencies in the C# preprocessor.  Those issues still exist, but a good thing about C# is you don’t get the following problem . . .

I’m working on a project for a customer that includes upgrading a VC++ 6.0 DLL to VC++ 2008.  There are some good resources on MSDN for breaking changes (for a starting point, see  Of course, I didn’t start there, I started by just trying it.  Pretty quickly I came across some of the breaking changes related to STL (specifically that iterators cannot be treated as pointers).

But I also had a pretty bewildering problem.  Hundreds of the following errors:

error C2371: 'std::tr1::placeholders::ks' : redefinition; different basic types 

The source of the error was C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xxbind1, line 298. Looking there, I found:

        namespace placeholders {    // placeholders
static _Ph<_NARGS> _CLASS_NAME(_);
        }    // namespace placeholders

Doing some investigation I found that xxbind1 is related to the TR1 extensions to the Standard Library.  The errors didn’t help me figure out where my code was including this file, so using the process of elimination (and the trusty binary search), I found that excluding the STL map header (i.e., <map>) solved this problem.  Not an option, though, since the code in question relies on stl::map.

So, I tried several other avenues to figure out what I was doing wrong.  While scouring all the application header files leading up to this include, I found the following line:

#define _    ks._

I thought, “wow, that looks awfully general for a preprocessor constant in the main internal header file”.  Going back to the code in xxbind1, now that error makes sense.

Removed it, and everything is fine. 

Arbitrary string-replacement before compilation is a powerful thing, but it can allow seemingly unrelated and unintended havoc.

Tags: , ,

A few things I don’t like about VS2008

Last week I posted on some things I like about VS2008.  Here are some things that I don’t particularly like, or at least things that I wish had been updated.  Consider these feature requests for VS.NEXT (or TFS power toys) or a service pack.

  • First of all, a bug.  It has a habit of closing itself.  I’m usually in the middle of a build when this happens.  It just goes “poof”.  Sometimes more than once a day.  Sometimes it does not repeat for days.

The rest of these are really just suggestions.  The Visual Studio Team will probably just roll their eyes and say “yeah, we know” or “why didn’t you suggest this before?”  Yeah.  Better late than never?

  • While targeting older versions of .NET 2.0 is great, I wish there was read-only support for VS2005 projects without conversion.   The driver for down-level support must have been to remove barriers-to-sale for existing VS2005 customers, but read-only support would have been better.  Why?
    • So teams with a lot of projects can “convert as they go” and not need to do a wholesale conversion of everything.
    • To make it easier to maintain older versions of their product without having to keep VS2005 around.
  • The source control diff tool needs to be updated.  My major annoyances?
    • It doesn’t use the same keyboard shortcuts as Visual Studio (or Office for that matter).  Alt-F3 for Find?
    • It can’t be minimized.  It can be resized, but why not minimized?
    • I would love to be able to diff with horizontal panes.  Since the code is so often wider than the pane, I have to scroll around.  This slows down changeset code audits.
  • While I love the Excel view of TFS work items, we still cannot edit the entire item from Excel.  I really hoped this would have been added. 
  • And on the subject of TFS, there should be a quick find feature built into the IDE.  Writing a query to do a find is too many steps.  We shouldn’t have to rely on outside tools for this (e.g., TFS Quick Search which hasn’t been updated yet).

Will there be more?  Certainly.  I haven’t spent much time with the new features of the IDE.  But I’m sure there will be a lot more that I like too — I’m very happy to be using the new IDE.

Tags: , , ,

A few things I like about VS2008

Leaving out all .NET enhancements, here are a few things I like about VS2008:

  • Down-level .NET support.  This makes the upgrade much easier for those of us who still support older versions of Windows that don’t support the new versions of .NET.  I wish they had gone a step further — I’ll write that up in a companion post.
  • Doesn’t require elevation.  I recently started using UAC again (i.e., I turned it back on) and found it annoying that I couldn’t drop files into VS2005 (since it runs elevated and Explorer does not).  It is important that VS2008 works unelevated, because UAC is important.  If you make it too hard for devs to use UAC, they’ll turn it off.  And as I know from personal experience, they won’t be as motivated to support it. 
  • Supports application manifest files as a project property (instead of through custom post-build steps).  We just implemented this manually for the “Certified for Server 2008 Logo” and I was very happy to eliminate that in favor of direct tool support.
  • It seems to start about 100 times faster than VS2005. I’m not kidding.
  • The Source Control “Annotate” feature — glad it got rolled into the release.  I like the fact that it is available directly from the history menu, making it much easier to find when some line of code was introduced.

Just a few things.  I’m sure I’ll find more soon.

Tags: , , ,

Certified for Windows Server 2008

Certified for Windows Server 2008We just received our certification for Windows Server 2008.  Or we are about to — it probably isn’t “official” yet.  Anyway, congratulations to the Digipede team and thanks to everyone at Microsoft and Veritest who helped us through the process.

Getting the logo was arduous.  This has less to do with the technical logo requirements and more to do with the complexities of the process itself.  Some of the complexity is inherent in such a process, but much was due to the program itself being a sort of “work in process”.  But hey, that’s why we early certifiers got the testing fees waived.  I think those who begin the process now will find the test requirements and tools are better written and more robust.

As I said, passing the technical requirements was not arduous for us (we were already very close), but passing the tests did require some minor improvements to the Digipede Network that were motivated by the test:

  • Support for User Account Control (UAC).
  • More useful logging on the Digipede Server and during installations.
  • Improved user messaging and event logging during error conditions between server components and the database.
  • Improvements to the Installation Guide including new sections on Custom Actions, installation artifacts, and more.

Some of these changes have already made their way into the shipping product, though others won’t be available until the Digipede Network 2.1 (which, while a minor upgrade, contains many features beyond the improvements mentioned above — I think the feature set will be announced soon).

So now we’re ready for the big launch of Server 2008, Visual Studio 2008, and SQL Server 2008 in Los Angeles on February 27th.  If you are going to be there, come see us at the Partner Pavilion.  I’m pushing for some kind of Digipede swag — but I’m not in marketing ;).

Tags: , , , ,