3 ms·
I think this article serves as a perfect example of why we should consider moving on from C. The first third of this article is "how to do memory allocation and
by maccard 2y ago
I think this article serves as a perfect example of why we should consider moving on from C. The first third of this article is "how to do memory allocation and work with strings".
The bit about OBJ parsing is neat, though.
- writebetterc 2y agoWhy isn't the conclusion "There is a far better way of using C, which the stdlib doesn't promote... But could"? The fact of the matter is that any sufficiently large C codebase will do this stuff anyway, it's not a language issue. Good Rust code will also care about memory allocations to the same degree as the C code, the difference is that Rust will help you out in making sure your thinking is correct. My experience is that good systems programming has thinking about memory allocations not as an annoying side issue, but as a main concern.
- flohofwoe 2y agoIf you even remotely care about performance you'll need to take care of such details in any language, and some high level 'managed' languages make that actually harder than C because you need to work around or even against builtin language features.
- maccard 2y agoI've spent my entire career working in C++ writing low level code for video games (and a decent chunk of it writing backend services for said games, and the glue between the two). If you want to talk about performance, you better come armed with numbers. If you don't, you're not writing "high performance" code.
- fsloth 2y agoA large part of high performance programming using any language is about memory management. For stuff that you run only for yourself and _always_ executes in a blink of an eye I do agree.
- maccard 2y agoI've spent my career ping ponging between writing fast low level code for games, and online systems. If you want to talk about high performance code, benchmarks are a requirement. There's no numbers here. It only talks about "Robust", which OP defines as: > By robust I mean no undefined behavior for any input, valid or invalid; no out of bounds accesses, no signed overflows. Input is otherwise not validated. Invalid input may load as valid by chance, which will render as either garbage or nothing. Robust is a baseline for high performance programming.
- tocariimaa 2y agoAlways when an article of this author gets posted on HN there's a Rust fanatic saying how his code does not work and how wrong he is for committing the sin of using C in current year.
- maccard 2y agoI didn't mention rust. I think he's used enough features of C++ to warrant using it instead.