3 ms·
If you know you want bytes -- A void* of unknown provenance cast to anything other than char* is UB so just skip the middleman and use char*.
by mwkaufma 4mo ago
If you know you want bytes -- A void* of unknown provenance cast to anything other than char* is UB so just skip the middleman and use char*.
- s28l 4mo agochar* can also be a C-style string. std::byte has the same special treatment in the standard as char and unsigned char, with the added benefit of not being used for other purposes (i.e. ASCII character or uint8, respectively).
- mwkaufma 4mo agoI was trying to appeal to OPs maladaptive "C++ that looks like C is more legitimate" aesthetic preference, haha.