4 ms·
> Because since those libraries are not built-in types, you always need to convert back to a ptr and length values at some point when interoperating with other
by jstimpfle 8y ago
> Because since those libraries are not built-in types, you always need to convert back to a ptr and length values at some point when interoperating with other C code.
And that's exactly why C wins, in my opinion. Because that means interoperability.
Storing a pointer + length pair in a fixed layout struct is bad from a normalization standpoint. They are independent data. If you don't separate them you will end up with data redundancies as soon as you have parallel arrays. If you use dynamic vectors and in C++ or similar languages and you ask yourself which is the object that you should call .size() on, that's when you notice that it's morally wrong to bundle pointer + length.
- pjmlp 8y agoThey are not independent, hence why 30 years since Morris worm, we keep increasing the amount of memory corruption exploits in C code. Or more precisely, 68% of Linux kernel exploits according to Google's talk at Linux Kernel Summit 2018.