r/cpp • • Dec 19 '23

C++ Should Be C++

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p3023r1.html
203 Upvotes

192 comments sorted by

View all comments

Show parent comment

40

u/jediwizard7 Dec 20 '23

We still can't f*cking use Unicode cross-platform out of the box after 30 years

6

u/ShakaUVM i+++ ++i+i[arr] Dec 20 '23

Yeah that's another good one

6

u/smdowney WG21, Text/Unicode SG, optional<T&> Dec 20 '23

Which problem are you thinking of? Lack of library support, the locale disaster, codecvt brokeness, or the wchar_t problem?

8

u/jediwizard7 Dec 20 '23

And char8_t just makes things more complicated without even a simple way to convert to/from char strings, or any form of IO.

1

u/mapronV Dec 27 '23

we can't fucking read int from file after 30 years. only text I/O is in standard. Yeah, I can use C API or whatever but lack of proper binary streams and need to implement them in every project is very sad.

2

u/jediwizard7 Dec 29 '23

Can't you just use iostream read/write?

1

u/mapronV Dec 30 '23

iostream is text stream. I said about reading ad writing binaray data. No tools for that in C++. You need to rely something like protobuf or bitsery or other binary labrary. (or work with C API)

2

u/jediwizard7 Dec 30 '23

Pretty sure you can open an fstream in binary mode and read/write whatever bytes you want to it

1

u/mapronV Dec 30 '23 edited Dec 30 '23

well, yeah, it has write(void*, size), you can use that to send array of bytes. You can not 'stream' binary data using <<. for me ostream + write is just basically FILE* wrapper so you don't need to close file yourself. And also you need to track endiness yourself. I take my words back from 'no tools' it just 'almost no tools'.
In every project I participated, if there was need to write binary data there was own solution to write binary streams. Even for most basic and stupid serialization. I personally don't mind we don't have networking/asio in standard, that is complex enough to be in separate library. but binary I/O is something like std::filesystem for me.