28 April 2016

Custom Deleters for C++ Smart Pointers

Custom deleters for C++ smart pointers

Let’s say we have the following code:

LegacyList* pMyList = new LegacyList();
...
pMyList->ReleaseElements();
delete pMyList;

In order to fully delete an object we need to do some additional action.

How to make it more C++11? How to use unique_ptr or shared_ptr here?

14 April 2016

Visual Studio C++ Productivity Tips

Visual Studio Productivity Tips

Visual Studio is my main development environment. I’ve been using this tool probably since version 2003…2005. I am really happy that VS is getting more and more powerful these days and you can also use it on multiple-platforms (through VS Code, for web or cloud apps). What’s even better - it’s free for personal use or if you’re a small company (Community Version)! Today, I’ve prepared some productivity tips that might make your life a bit easier when developing an app in this Microsoft IDE.

I target native app development, but most of the rules should be generic to other languages as well.

17 March 2016

The Matrix Updated

The Matrix demo project

Sometimes you can find interesting stuff in your past projects!
One day I was thinking about new post topics for the blog, but somehow, I got not much energy to do it. So, I just browsed through my very old projects (that are actually listed in my portfolio site). Memories came back and I decided maybe it’s time to refresh the ancient code files!

This time let’s go into Matrix!

03 March 2016

Nice C++ Factory Implementation 2

Nice C++ Factory Implementation

The original code from my previous post about “nice factory” did not work properly and I though there is no chance to fix it.
It appears, I was totally wrong! I got a really valuable feedback (even with source code) and now I can present this improved version.

25 February 2016

SFINAE Followup

SFINAE follow up

As it appears, my last post about SFINAE wasn’t that bad! I got a valuable comments and suggestions from many people. This post gathers that feedback.

18 February 2016

Notes on C++ SFINAE

Starting with C++ SFINAE

This time I’d like to tackle a bit more complex problem: SFINAE. I’m not using this paradigm on a daily basis, but I’ve stumbled across it several times and I thought it might be worth trying to understand this topic.

  • What is SFINAE?
  • Where can you use it?
  • Do you need this on a daily basis?

Let’s try to answer those questions.

04 February 2016

Revisiting An Old Benchmark - Vector of objects or pointers

Revisiting old benchmark code

Around one and a half year ago I did some benchmarks on updating objects allocated in a continuous memory block vs allocated individually as pointers on the heap: Vector of Objects vs Vector of Pointers. The benchmarks was solely done from scratch and they’ve used only Windows High Performance Timer for measurement. But, since recently I’m interested in more professional benchmarking libraries it would be good to revisit my old approach and measure the data again.

21 January 2016

Micro benchmarking libraries for C++

benchmarking

After I finished my last post about a performance timer, I got a comment suggesting other libraries - much more powerful than my simple solution. Let’s see what can be found in the area of benchmarking libraries.

07 January 2016

Simple Performance Timer

When you’re doing a code profiling session it’s great to have advanced and easy to use tools. But what if we want to do some simple test/benchmark? Maybe a custom code would do the job?

Let’s have a look at simple performance timer for C++ apps.

31 December 2015

C++ Status at the end of 2015

Maybe I’ll be boring with this note, but again I need to write that this was another good year for C++!
Here’s a bunch of facts:

  • Visual Studio 2015 was released with great support for C++14/17 and even more experimental features.
  • Long-awaited GCC 5.0 was released at the beginning of the year.
  • C++ gained a huge boost is popularity around July, 3rd stable place in the Tiobe Ranking
  • At CppCon 2015 there were some really important announcements made.
  • C++17 seems to be just around the corner!
  • And one sad news...

See my full report below.

22 September 2015

Visual Studio slow debugging and _NO_DEBUG_HEAP

Verify you assumptions about tools you use!

Some time ago I was tracing a perf problem (UI code + some custom logic). I needed to track what module was eating most of the time in one specific scenario. I prepared release version of the app and I added some profiling code. I’ve used Visual Studio 2013. The app used OutputDebugString so I needed to run the debugging (F5) in order to be able to see logs in the output window (I know I know, I could use DebugView as well…)
But, my main assumption was that when I run F5 in release mode, only a little performance hit would occur. What was my astonishment when I noticed it was a wrong idea! My release-debug session pointed to a completely different place in the code…

30 August 2015

OpenGL SuperBible 7th

OpenGL Superbible 7th

Several moths ago I’ve noticed there would be another version of OpenGL Superbible. This time the 7th edition! Without much thinking I quickly I pre-ordered it. Around two weeks ago the book appeared at my doorstep so now I can share my thoughts with you.

Is this book worth buying? Is the new content described in an valuable way? Let’s see…

27 May 2015

Applying the Strategy Pattern

Let’s look at the following problem:

We are designing a drawing application. We want some objects to be automatically scaled to fit inside parent objects. For example: when you make a page wider, images can decide to scale up (because there’s more space). Or if you make a parent box narrower image needs to scale down.

What are the design and implementation choices that we can make? And, how the Strategy pattern can help?

17 April 2015

PDB Was Not Found - Linker Warning

You’ve just recompiled a 3rd party library in Visual Studio, copied the .lib file into a proper directory, added dependencies into your final project… recompiled and it worked nicely! Good. So now you can commit the changes into the main repository.

Then, unfortunately, you got a report from a build server (or from your colleague) that your recent change generated 10s of warning messages about some missing files from this new library… why is that? It worked well on your local machine! :)

Possible reason: missing PDB information.

Content By Bartlomiej Filipek, Blogger platform
Any opinions expressed herein are in no way representative of those of my employers.
To provide you service this website uses cookies. By using it, you agree to this. More info.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.