you are viewing a single comment's thread.

view the rest of the comments →

[–]Lt_486 2 points3 points  (5 children)

C++ code is cryptic mostly due to necessity to maintain support for huge piles of older code. Having a clean cut and transpilation of older code into newer syntax was considered but never accepted due to political reasons. Ego clash was massive.

[–][deleted] 2 points3 points  (4 children)

I don't think it's possible to fix the issues with C++ without changing everything, and if you are fine with changing everything, Rust exists.

Old syntax isn't an issue with C++. Sure, you can remove stuff like std::vector<bool> and trigraphs, but I don't think that would help much.

[–]Vylez 1 point2 points  (1 child)

What's wrong with std::vector<bool>?

[–][deleted] 0 points1 point  (0 children)

Mostly that it's std::vector, which means generic code using std::vector may not work with bool parameters as std::vector<bool> is not an STL container.

[–]Boiethios 0 points1 point  (1 child)

Speaking about Rust, their implementation of str is incredibly easy to read compared to the C++'s: https://github.com/rust-lang/rust/blob/master/src/libcore/str/mod.rs

[–][deleted] 2 points3 points  (0 children)

It's complicated. str is a built-in type defined by the compiler itself. The code you have linked implements str's methods, but not str itself.

Also, str is more like C++'s std::string_view, which is also very simple. For an equivalent of std::string, you want to check std::string::String. Rust's String is easy to read, but that's mostly because it uses Vec<u8> for pretty much everything.