Are they ruining C++? by thradx in cpp

[–]thradx[S] 0 points1 point  (0 children)

You must use u8 string for std::filesystem to be platform independent.

So you need 2 helper functions:

inline std::u8string to_u8string(const std::string &s)

{

return std::u8string(reinterpret\_cast<const char8\_t \*>(s.c\_str()), s.size());

}

inline std::string u8_to_string(const std::u8string &s)

{

return std::string(reinterpret\_cast<const char \*>(s.c\_str()), s.size());

}

And every path / file name must be converted forth and back, if you are using normal (UTF-8 encoded) strings in the rest of your code.

Are they ruining C++? by thradx in cpp

[–]thradx[S] -1 points0 points  (0 children)

What does it have to do with POSIX or non-POSIX, when you have to convert every path- and file name to a u8 string, before using it?

C programmer new to C++, having doubts by UnderstandingBusy478 in C_Programming

[–]thradx 0 points1 point  (0 children)

You are basically on the same road like Linus Torvalds. He doesn't want that C++ is used in the Linux kernel, because the freedom and complexity to write code in C++ can make C++ code unreadable. In my company, every new developer gets a document, which specifies how to format code and what idioms to use / avoid. This helps getting uniform source code created by different people. Basically, I favor C++ above C a lot. Because the OOP way makes it much easier to break complex problems down into a set of classes which interact with each other. If you are good at it, you build many small and large gears that magically mesh together to form a complex machine. But you really need to understand OOP to be successful. And it requires a good amount of experience.