Tasks with std::future and std::async

Let us consider a simple task: “Use a worker thread to compute a value”. In the source code it can look like that: std::thread t([]() { auto res = perform_long_computation(); }; Now, you would like to obtain the result when the computation is completed. How to do it efficiently?

READ MORE...

C++ status at the end of 2013

C++11 conformance GCC 4.81 - 100% Clang 3.3 - 100% Intel 14.0 - 84% Visual C++ 2013 - 66% Another year is almost over so it is a good time to check what is going on with C++. This time more stats and real data compared to my post from the previous year.

READ MORE...

The Passionate Programmer

How to be a better programmer? What technologies should be learned? How to have fun when coding? Read more to see where are the answers for those questions. Intro Programmers have this wonderful opportunity to often pursue a dream career path. Lots of us would not like to only pay the bills but actually change the world as well.

READ MORE...

Digging into SOIL Library for OpenGL

When I was (re)implementing PhotoAlbum sample application I got stuck in one place. Program was about to load a list of textures (like 16 maybe) and suddenly I noticed that the whole process takes quite long time. More disappointing thing was that I got memory access errors for some images and configurations.

READ MORE...

Book: OpenGL Development Cookbook

Recently, thanks to a contact with Packt Publishing, I got a chance to take a look at the new OpenGL book. It is called “OpenGL Development Cookbook” and contains lots of interesting ideas (40 items!) regarding graphics programming. Let us dig into book’s pages to see its real value.

READ MORE...

Code Kata - chop

As it appears, our ability to code can be improved by taking some practices from martial arts! CodeKata is a catchy name for set of exercises that done regularly should make your coding skills better. Today I would like to share my “answers” to one of the Kata - karate chop, or simply the binary search algorithm.

READ MORE...

Auto keyword in C++11

// how does it work? auto i = 0; // ?? C++11 brings us a very useful set of tools. It adds fresh air to the hard life of a programmer. The updated syntax makes the language a more modern and easier to use. In this post let’s take a quick look at a nice keyword ‘auto’ that, at first sight might seem very simple.

READ MORE...

Book: The C++ Standard Library, 2nd

The C++ Standard Library: A Tutorial and Reference (2nd Edition)< /> We are still waiting for some more books about new C++ standard. Fortunately for us, some authors managed to write books even before C++11 is well “domesticated”. One of such examples is the book mentioned in the title of this post.

READ MORE...

#Include little toolkit

Include Guards, Pragma Once, Predeclarations and other hints that might be useful when dealing with includes. What can we do with file including in C++? Do we need to put all the other header files of the project (plus third party libraries) in every file all the time? For sure there have to be some rules to manage that issue properly.

READ MORE...

Forward Declaration And a Pointer

Mister C was a cool guy. C could make amazing things with just ordinary text files. He used to grab bunch of them and produce magic binary forms. He could make a spinning cube, web server, or even an operating system. One time he was running through a plain header file.

READ MORE...

Artykuł, Software Developer Journal

Zapomniałem jeszcze dodać w ostatnim (a w zasadzie pierwszym poście), że będę czasem pisał po polsku. Zauważyłem, że nie da się tego uniknąć, więc nie będę się opierał :) Jutro na wykładzie z programowania gier w openGL, będę mówił o postprocessingu sceny. Całość będzie dostępna u mnie na stronie w katalogu teaching/ogl2… i przy okazji sobie przypomniałem, że niecały rok temu udało mi się napisać artykuł doSoftware Developer Journal pod mniej więcej tym samym tytułem!

READ MORE...

__FUNCTION__ macro in Visual C++

Recently, I’ve found something interesting in Visual Studio that improved my Logger! I had a function called AddMsg /** appends message to the log file */ void AddMsg(LOG_MODE m, int level, char* strModule, char *strMsg, ...); But, when you wanted to add a comment you needed to use quite complicated and long syntnax, like:

READ MORE...