On Fri, Apr 13, 2018 at 11:06 AM, Emilio Cobos Álvarez <emi...@crisal.io> wrote:
> I'd be ok with that I guess, though it's more common each time? Also, is
> there any case where you could use braces but not parenthesis? (I'm not a
> C++ expert in this regard).

I think there are. In particular if you're initializing a struct by
members which doesn't have a constructor. For instance, when I
recently upgraded layers id from a uint64_t to a struct, I had to use
{} in initializer lists instead of () because I didn't add a
constructor to the struct. Here's a simple example:

struct Foo {
    int x;

struct Bar {
        : mFoo(0)   // <-- this fails, but {} will work

    Foo mFoo;
dev-platform mailing list

Reply via email to