Category Archives: VC++

Vector Deleting Destructor and Weak Linkage

Now that the discussions on weak linker symbols and vector deleting destructors are in place, it is time to discuss a fact that might seem esoteric but has far reaching implications. After that, it is time to ask for your … Continue reading

Posted in VC++ | 9 Comments

Executing Code Once Per Thread in an OpenMP Loop

Take this toy loop: Now suppose you want to run some preparation code once per thread – say, SetThreadName, or SetThreadPriority or whatnot.  How would you go about that? If you code it before the loop the code would execute … Continue reading

Posted in C++, VC++ | 5 Comments

On Vector Deleting Destructors and some new/delete internals

A word is due on vector deleting destructors – previously mentioned as the only functions that got weakly bound by the linker. The usual disclaimers apply: everything that follows is my own investigation, in code and online. Nothing here is … Continue reading

Posted in VC++ | 4 Comments

Setting a Watch on Wide Registers in VS

General-purpose registers can be watched from the watch window pretty much as regular variables: (the ‘$’ prefix is optional, but is recommended by MS – probably as means to minimize clashes with code variables.) It is less known that you … Continue reading

Posted in Debugging, VC++ | Leave a comment

x86/x64 Numerical differences – Correction

In a previous post a truncation scheme was suggested, to circumvent x86/x64 differences in math library implementations: Since then, I accumulated some mileage with the scheme and have come to understand that line 8: -is flawed. Since we drop the … Continue reading

Posted in Algorithms, C++, VC++ | Leave a comment

Linker Weak Symbols

C++’s One-Definition-Rule roughly states that In the entire program, an object or non-inline function cannot have more than one definition; if an object or function is used, it must have exactly one definition. Which sounds like a good idea – … Continue reading

Posted in VC++ | 3 Comments

x86/x64 Library Numerical differences

There are many online sets of examples of 64 bit migration pitfalls, but I recently came across two that that appear not to be mentioned elsewhere. First, downright compiler bugs.  We still have those and some raise their head only … Continue reading

Posted in VC++ | 3 Comments

Another Look at the VS2012 Auto Vectorizer

A while ago I did some experimenting with (than beta) VS2012. After these experiments our team migrated to the 2012 IDE but kept to the 2010 toolset. Since then much had happened: an official VS2012 launch + 4 updates, rather … Continue reading

Posted in VC++ | Leave a comment

Find Where Types are Passed by Value

Say you’re working on a large code base, and you came across several instances where some type of non-negligible size was passed as argument by value – where it was more efficient to pass by const reference. Fixing a few … Continue reading

Posted in VC++ | 2 Comments

Discovering Which Projects Depend on One

I am working with several large-ish (100+ project) solutions – and at this scale, dependency management is a very real issue. While you can easily view (and set) the dependencies of a project by viewing its references, there is no … Continue reading

Posted in VC++, Visual Studio | 2 Comments