logoalt Hacker News

stephencanon • today at 2:07 PM • 1 reply • view on HN

As is usual for C++, the committee made arbitrary changes from what C had already laid out that made the feature worse. In particular, C++ requires that the fields appear in order, which means you cannot use it to do what the linked page shows.

This isn't usually a huge deal, because C++ gives you other ways to have overloaded functions and default parameters, but it is sometimes mildly annoying.


Replies

pjmlp • today at 2:41 PM

C doesn't have constructors, and field initialisation order matters.