News for hackers. Stuff that matters.
Re:We used C++20 to eliminate a class of runtime bugs by pierrebai on Friday January 14, 2022 @04:13PM (#29940529)
Oh how I agree about the uniform initialization! And to make matter worse, I now work on a code base where it is the mandated form in the coding standard. At least your initial example now gives me ammunition against it, but too late for this coding standard.

It makes code look silly, too, as now initialization looks different from assignment.

     int i { a + 2 };
     i = a + 4;
     
     int j = a + 2;
     j = a + 4; // ah! consistency!
Re:We used C++20 to eliminate a class of runtime bugs by ncmncm on Friday January 14, 2022 @04:28PM (#29940685)
It is good for initialization to look different. It is different. Not so much so for int, but maybe hugely different for other types.
Re:We used C++20 to eliminate a class of runtime bugs by pjmlp on Saturday January 15, 2022 @03:57AM (#29944945)
To build up on sibling's answer that isn't the same thing.

The first one will call the initialization constructor, whereas the second form will initialize the object and then apply one form of copy construction, depending on which ones are available (user provided or compiler generated).

It just happens that for int that doesn't matter in practice.