Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From a post in /r/cpp [1],

> As of C++20, the right way to write a trivial getter in C++ looks like `[[nodiscard]] constexpr auto GetFoo() const noexcept -> Foo { return foo_; }`

C++>11 is such a mess than most useful changes are invisible to most users due to bloat.

I think it's way past time to call it quits and abandon active development of the language. New features will come from other languages without 35 years of baggage.

[1] https://www.reddit.com/r/cpp/comments/swv6wh/when_not_to_use...



I'm not sure it is remotely reasonable to choose a language for a project based on the verbosity of accessor signatures when being maximally pedantic.

C++ is indeed a mess but there is almost no alternative for existing enormous codebases than to keep making it better. The industry will slowly adopt memory safe system languages, but that's going to take ages to go beyond greenfields and absolutely security-critical systems.


Why would you write a trailing return type for a simple getter?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: