Yes indeed, or serializing pre-encoded arrays of bytes, which have a known format. In fact, my library discourages use of raw IO, and provides a method to wrap the raw io to perform serialization according to a binary IO specification I am working on. However, the usefulness of raw serialization is enough to warrant it continuing to exist, hence limiting it by expressing UB that basically already exists.
connor horman via Std-Proposals:
> I am working on a library in C++ that has IO Capabilities, and as part of
> the library, I define a couple of named requirements that types being
> written or read “raw”
Obvious note that this makes data non-portable and only useful for
inter-process communication on the same ABI.
I'm working on a proposal that provides safe and portable IO by default:
https://github.com/Lyberta/cpp-io
Unsafe IO such as memcpy-ing structs can be coded as specializations in
my design.
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals