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 →