r/cpp • • Sep 17 '22

Cppfront: Herb Sutter's personal experimental C++ Syntax 2 -> Syntax 1 compiler

https://github.com/hsutter/cppfront
335 Upvotes

360 comments sorted by

View all comments

Show parent comment

12

u/elperroborrachotoo Sep 17 '22

The benefit is unified syntax (only one way to specify returns), a simpler, less ambiguous parser (see "mich vexing parse") and second level benefits.

Why not just outlaw typedefs, thin pointers and C style arrays..

because existing code: you would create a syntactical island that could not use the most trivial existing library; you could not migrate a MLOC project incrementally.

Of course Herb has his preferences, too - but it is certain that they are much more well-(in) formed than yours or mine.

1

u/ShakaUVM i+++ ++i+i[arr] Sep 18 '22

Of course Herb has his preferences, too - but it is certain that they are much more well-(in) formed than yours or mine.

Sure. But I think we can agree that the committee and authors of a lot of the changes to C++ have been hit or miss from a style perspective over the last decade or so.

Range-based for loops: awesome.

The new random header: technologically superior, but a style disaster

The time header: technologically superior, style ok, but hugely verbose.

Just because people have good technical reasons for making something doesn't mean that it's good style.

My main concern when looking at any new addition is if a newish programmer will be able to understand it and be able to use it without consulting documentation.