July 7, 2017
In C++ language, output streams are a nice way to display information in console. There are some caveats we can talk about - like bufferization, statefulness - but it is not the goal of this article.
Streams have a cool feature to format output (and input) called manipulators. Some of them:
- flush / endl
- oct / dec / hex
- boolalpha / noboolalpha
- setw() / setfill()
An interesting question is: can we add our owns manipulators?
Yes we can! And this is the purpose of this post.
February 3, 2017
I found on reddit a very interesting post on C++ quizzes.
I did not know that such things exist, so it was an interesting discover. Now, I can test myself on this vast subject!
February 2, 2017
I usually change a lot of workspaces during my workday. Generally, I have to load or unload different environments: python virtualenv, ruby gems, node modules…
It’s not very convenient to call the right executable or to change
PATH variable (or others) when I switch projects.
Finally, I found an incredible tool for this task :
January 19, 2017
Sometimes, you must create a path in an application. The main function to use on Posix is
mkdir, but it is limited to one directory.
When you want a full path like
./users/romain/tests/test1, but you do not know which parts exist, I have a function for this.
January 19, 2017
Let’s use a new C++11 feature: user-defined literal.
Thanks to this one, you could now declare new type from a string or a number. For example
"2012-10-30"_date can create a new Date object with these information.
But we could use this feature to other useful things, like format a nice output.
January 18, 2017
Today, I would like to talk about the usage of
decltype specifier. Appeared in C++11, this new keyword “returns” the type of a variable or an expression. It is similar to
auto keyword but not in all situations.
January 12, 2017
One of several problems that occurs when you develop scripts is the selection of the right executable, for example usually with python, you can have three executables:
python (which points to one of previous).
The problem happens when you have to run your script:
- by using executable name on command line
- or with a shebang
January 11, 2017
I just watched a very interesting conference on how a race detector works. I learned a lot of new things such happened-before relation and vector clock algorithm. But I am not going to talk about these concepts now.
The purpose of this article is to discover how to detect a race in a C++ executable (or any other common mistakes).
December 16, 2016
In this new year 2017, I am opening this blog!
I would talk about various subjects: programming, cinema, readings… In fact, everything that comes to my mind.