6 ms·
I'm not an expert, but I think it's because c++ is _heavy_. Start using a few features like genetics and suddenly your binary and compile times grow substantial
by bmon 9y ago
I'm not an expert, but I think it's because c++ is _heavy_. Start using a few features like genetics and suddenly your binary and compile times grow substantially. You only need to look at chrome to see this happening.
- krylon 9y agoMicrosoft and Apple develop their respective kernels in C++, and AFAIK, developers are limited to a very restrictive subset of C++, classes are forbidden, so are exceptions, so are new/delete. I think, templates are forbidden, too, but I am not certain. Once you shrink C++ down to such a subset, it is substantially less heavy. I do not think I am qualified whether that makes it a better choice, but means there are examples of fairly successful operating systems whose kernels are written in C++.
- mywittyname 9y agoOnce you've striped all those features from C++, what's left to differentiate it from C? I've only used C++ in an academic setting.
- krylon 9y agoNB that I have only a little experience with C++ and none whatsoever with kernel and/or OS development. > Once you've striped all those features from C++, what's left to differentiate it from C? Not much, I suspect. You can declare variables anywhere instead of just the beginning of a block, you can use references, and C++ handles const-ness much better than C. Function and operator overloading is a double-edged sword, but it is possible to use them in a way that makes code easier to write, read, and maintain. C++ being C++, there are surely a bunch of things I miss. But yes, without all the advanced features the gap between C and C++ shrinks significantly,