News for hackers. Stuff that matters.
Re:What can C++ do for embedded systems developers? [video] by nrclark on Monday September 24, 2018 @11:44AM (#18058648)
Around the 30 minute-mark, I noticed some weird syntax that I've never seen before. I dabble in C++ at my job, so I'm not a total newbie. But what do those braces mean on 'weekday'? Is that some kind of class constructor or something?

Code in question was:

  cout << weekday{October/19/2017} << '\n';
Re:What can C++ do for embedded systems developers? [video] by bstamour on Monday September 24, 2018 @11:59AM (#18058778)
It's an example of uniform initialization syntax that was brought into the language in C++11. It simplifies some things (no narrowing conversions allowed) but also complicates things (if any constructor takes in an initialize-list, it gets priority). In this case, the code is constructing an object of type weekday from an expression that represents that particular date.
Re:What can C++ do for embedded systems developers? [video] by Game_Ender on Monday September 24, 2018 @12:09PM (#18058868)
It's "aggregate initialization" [0]

  struct S {
      int x;
      struct Foo {
          int i;
          int j;
          int a[3];
      } b;
  };
  S s1 = { 1, { 2, 3, {4, 5, 6} } };
0 - https://en.cppreference.com/w/cpp/language/aggregate_initial...
Re:What can C++ do for embedded systems developers? [video] by planteen on Monday September 24, 2018 @03:20PM (#18060560)
I don't think that is what is going on, this is invoking the constructor for the weekday class with the "modern" uniform initilization syntax. This solves the old C++ most vexing parse problem.

https://en.wikipedia.org/wiki/Most_vexing_parse

It seems like this is the C++ class in question: https://howardhinnant.github.io/date/iso_week.html