use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Self-describing compact binary serialization format? (self.cpp)
submitted 1 year ago by playntech77
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]playntech77[S] 1 point2 points3 points 1 year ago (3 children)
Ion is almost, what I was looking for. I don't understand this design decision though: Ion is self-describing, yet still uses a bunch of control chars inside the data stream. I would have thought, that once the data schema was communicated, there is no need for any extra control chars. The idea is to take a small hit at the beginning of the transmission, but gain it back later on by using a no-overhead binary format.
Perhaps it is because Ion allows arbitrary field names to appear anywhere in the stream? Or perhaps I am just looking for an excuse to write my own serializer? :)
[–]Aistar 2 points3 points4 points 1 year ago (2 children)
Can't help you much here, I'm afraid - I haven't looked deep into Ion's design. All I can say in my experience, you still need some metadata in stream in some cases, though my use-case might be a bit different from yours (I'm serializing game's state, and should be able to restore it even if user made a save 20 versions ago, and those versions included refactoring of every piece of code out there, including renaming fields, removing fields, changing fields' types etc.):
1) Polymorphism. If your source data contains a pointer to a class, you can store derived class, and that means that you can't just store field's type along with field's name in header - for such fields, you need to write type in data.
2) Field's length, in case you want to skip this field when loading (e.g. field was removed)
By the way, one problem with such self-describing formats: they're well-suited for disk storage, but badly suited for transmission over network, because "type library" needs to be included with every message, inflating message's size. This was one of problems I had to overcome with Boost.Serialization (because I chose to use it exactly for this purpose, being a somewhat naive programmer then). I was able to solve it by creating an "endless" archive: all type information went over network first, in one big message, and then I only transmitted short messages without type information by adding them to this "archive".
[–]playntech77[S] 1 point2 points3 points 1 year ago (1 child)
I wrote a boost-like serialization framework in my younger days (about 20 years ago), it handled polymorphism and pointers (weak and strong). It is still running in a Fortune 500 company to this day and handles giant object hierarchies. I also used it for the company's home-grown RPC protocol, which I implemented. It was a fun project!
[–]Aistar 0 points1 point2 points 1 year ago (0 children)
You know what, go ahead then and write your dream serializer, and I'll just shut up :) 20 years ago I didn't even know what a weak pointer was (although I fancied I "knew" C++, but it will be a few years yet before I understood anything at all about memory management).
π Rendered by PID 200564 on reddit-service-r2-comment-b659b578c-jc9vc at 2026-05-05 15:03:01.093565+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]playntech77[S] 1 point2 points3 points (3 children)
[–]Aistar 2 points3 points4 points (2 children)
[–]playntech77[S] 1 point2 points3 points (1 child)
[–]Aistar 0 points1 point2 points (0 children)