DEV Community

loading...

Discussion on: IDE-isms - How does your IDE affect your coding style?

Collapse
tmr232 profile image
Tamir Bahar Author

I noticed that when writing C++ is CLion, I tend to initialize member reference variables with () instead of {}.

// CLion < 2017.3
struct Foo {
    Foo(Bar& bar): _bar(bar) {
    }

    Bar& _bar;
}

// CLion >= 2017.3
struct Foo {
    Foo(Bar& bar): _bar{bar} {
    }

    Bar& _bar;
}

This was because CLion had an some issues with initialization lists, and kept warning me that the latter is wrong. Now that the bug is fixed, my code style is changing.