4 ms·
Well to be pedantic C++'s type system doesn't check for that either it just passes around a size_t and char *.
by nwmcsween 8y ago
Well to be pedantic C++'s type system doesn't check for that either it just passes around a size_t and char *.
- saagarjha 8y agoI was referring to std::string, which is what you should be using if you're handling textual data natively.
- gmueckl 8y agoAnd it's even possible to use std::string as a buffer for binary data including NULs. I won't recommend it, but it works.
- saagarjha 8y agoI'd suggest using a std::vector of byte-sized integers for clarity, though there's nothing wrong from a standards point in using a std::string.
- nwmcsween 8y agoThe implementation of std::string is 99.999% of the time struct { char *s; size_t len; }, which has nothing to do with an actual type.