Qt Creator allows you to open and run multiple instances of Qt Creator at the same time. But there is a small glitch. If you are running multiple instances of Qt Creator, only the first instance displays the console output in the Application output console. The second instance would complain with the following error message:

Cannot retrieve debugging output

Fix for this is to close the second instance or open the project you want to edit and debug in the first instance.

boot2docker is great. It allows us to develop using docker even on Windows PCs. One feature that is totally awesome is its ability to share folders on windows host with boot2docker virtual box image. This shared folder from windows can then be used as a volume in the docker containers.

The first part is available to you out of the box. boot2docker shares the c:\User directory with the boot2docker virtualbox image and mounts it under /c/. Yay!

You can add this folder or part of it to the docker container as you would with normal folders.

docker run -it -v /c/:/data/ : bash

This will add the whole C:\User under /data in the launched docker container.

First thing first, never initialize nor declare multiple variables on the same line. It makes things very difficult to understand. But if you have to, this post will help you.

Initializing multiple variables in same line like this:

int p, q = 10;

is ambiguous because it is hard to understand if only q is initialized to 10 or if p is also initialized to 10. Of course, in this case only q is initialized to 10. To avoid the ambiguity, each initialization can be done in its own line.

int p;
int q = 10;

Also, try to initialize automatic variables (especially pointer variables) when they are declared.

First thing first, never declare multiple pointer variables in same declaration statement. Don’t mix declaration of pointer and non-pointer variables in same line. Following this will save you a lot of debugging time in the future.

But in case, you are forced do it or you are debugging code written by somebody else, this short post can help you.

What does this code really mean?

int* c, d;

It is clear that c is a pointer to integer. But what about d? Is it integer or pointer to integer? Ofcourse, it is integer not a pointer to integer. Using declaration as above is very ambigious. Avoid it any cost. Instead, declare them on their own statements.

int* c;
int d;

Much clear. Isn’t it?

It is also better to follow this rule when all variables are pointers. Also, I prefer to put the star next to varaible name instead of the variable type.

This small snippet of code will help you monitor the memory and processor usage of a process over time in the background and redirect the output to a file. You can later use the file to analyze its behaviour.