4 ms·
> There's nothing in C that prevents you from doing this either Yet these errors consistently happen in C projects of various sizes.
by Elinvynia 4y ago
> There's nothing in C that prevents you from doing this either
Yet these errors consistently happen in C projects of various sizes.
- greysphere 4y agoMight be some survivorship bias.
- vore 4y agoI am a Rust evangelist as much as the next person, but this is really a case of C developers preferring caller reallocation over callee reallocation, which as the root comment points out is fraught with danger. If the C implementation here used callee reallocation, while you do still have to be careful, the risk of this kind of error is greatly reduced (but at the cost of having to use dynamic memory, which might not be appropriate in all cases). Yes, Rust would eliminate this error, but you can still do it "safer" in C (but you have to give up certain things to do it that way).
- bombolo 4y agoBecause all the important and used stuff that gets looked at is written in C. At the moment rust is used for some very marginal and unimportant leaf projects.