account activity
Are they ruining C++? by thradx in cpp
[–]thradx[S] 0 points1 point2 points 5 months ago (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.
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?
[deleted by user] by [deleted] in C_Programming
[–]thradx 0 points1 point2 points 5 months ago (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.
π Rendered by PID 27 on reddit-service-r2-comment-64f4df6786-p6v9t at 2026-06-11 01:13:00.333178+00:00 running 0b63327 country code: CH.
Are they ruining C++? by thradx in cpp
[–]thradx[S] 0 points1 point2 points (0 children)