Re:Cppfront, Herb Sutter's proposal for a new C++ syntax
by 01100011 on Sunday September 18, 2022 @07:09PM
(#32892348)
Yeah, that just strikes me as weird.
Re:Cppfront, Herb Sutter's proposal for a new C++ syntax
by int_19h on Sunday September 18, 2022 @07:16PM
(#32892383)
It makes it more consistent with statements, and more convenient for one-liner functions (e.g. those that just delegate to another function).
It's also something that was adopted by other languages in the curly braces family - e.g. C# originally required curly braces for function bodies, but now allows you to write:
int Sum(int x, int y) => x + y;
What do you mean? It uses curly braces for compound statements. But it doesn't require curly braces to define a one-line function.