logoalt Hacker News

mwkaufmatoday at 1:39 PM1 replyview on HN

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*.


Replies

s28ltoday at 1:46 PM

char* 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).

show 1 reply