Category Archives: C++

CMake Rants

CMake is a highly popular ‘meta-build’ system: it is a custom declarative syntax that is used to generate build scripts for all major OSs and compilers (e.g., VS solutions and projects). Designing such a system is a formidable task, but … Continue reading

Posted in C++ | 15 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

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

C++ Template Meta Programming is Still Evil

I won’t include a meta-programming intro paragraph here, since if you’re not familiar with it – I sincerely hope you stay that way. If you insist, get an idea online or read the book (it’s a good read, but can’t … Continue reading

Posted in C++ | 33 Comments

Ternary Operator and Type Compatibility

The (?,:) operator, as in – is commonly referred to as the Ternary Operator. (It is a common abuse of terminology: a ternary operator is one that operates on three arguments. This particular ternary operator is the Conditional Expression operator.)  … Continue reading

Posted in C++ | 4 Comments