Ne v kontakte Antisocial programmer's blog

Comment branching in C++

Comment branching in C++

    c++     programming     tricks

Recently I’ve stumbled upon a code snippet in my C++ code, which I’d call “comment branching”. For example, you are experimenting with two implementations of the same functionality represented by a relatively small pieces of code and you need to switch between them back and forth until you decide which one will end up in final version.

Consider following snippet:

   

   

<>

If you simply remove first slash from the second line, it turns into this:

Read more →

Rogue Ninja support in CLion

Rogue Ninja support in CLion

    c++     clion     cmake     ninja     projects     dev

In a past few years I’ve been using C++ as my main programming language and during this time I’ve been in constant search for better IDE for it which would run on Linux. I was very happy when Jetbrains released CLion IDE and immediately gave it a try. Though there is a lot to improve yet, I’d say that it has best autocompletion and modern C++ support among C++ IDEs on Linux. The only problem I had with it was a build toolchain which it uses.

Currently CLion supports only CMake projects (with is totally fine for me) with GNU Make generator (which is sad). When using CMake, I always preferred Ninja build system, especially for large projects like one I work on as my main job. For some reason Make does not a very good job at incremental builds. For example, even if there is nothing to rebuild, it spends 5 seconds to only verify this fact, which is pretty annoying. On other hand, Ninja does this in like 200 ms.

Unfortunately, CLion developers currently have no plans on supporting Ninja (I realize that they have many things to do way more important than Ninja support), so I decided to solve this problem by myself.

CMake-Ninja wrapper for CLion

Read more →