2 ms·
Why write it in C rather than in modern C++? Toolchain is pretty similar, often more performant, you protect yourself against memory leaks, dangling file descr
by einpoklum 6y ago
Why write it in C rather than in modern C++?
Toolchain is pretty similar, often more performant, you protect yourself against memory leaks, dangling file descriptors as such (yes, without needing a garbage collector [1]), and some decent libraries to help you out with what you're not writing yourself.
(Potential answer: Bigger executable if you're not careful. In some cases that could be a consideration. [2])
--
[1] : https://stackoverflow.com/a/48046118/1593077 https://stackoverflow.com/a/48046118/1593077
[2] : https://softwareengineering.stackexchange.com/q/246167/63497 https://softwareengineering.stackexchange.com/q/246167/63497
- userbinator 6y agoYou can write a C compiler relatively easily. In fact there have been numerous articles submitted to HN about someone who did. I don't think anyone has done the same with C++, because of its immense complexity. and some decent libraries to help you out with what you're not writing yourself. If you're writing a shell you are probably already somewhere on the "bootstrap pilgrimage". Using something someone else has written is the exact opposite of what you want to do in that case. (Why not just use a shell that someone else has written then...?)
- kwdc 6y agoSome might say that as many people started writing c++ compilers as those of C but that the C++ crowd just haven't finished them. Perhaps another decade? I don't envy anyone writing such a compiler. Its possible but I didn't start one. Seemed like less fun and more like red tape. The pilgrimage thing is real. Done it myself. The journey from even boot to bash is real and the benefits of awareness it brings definitely appear in strange places. I went even further before the "boot" stage.