Octacone wrote:
7th time wow, I can relate to you.
![Razz :P](./images/smilies/icon_razz.gif)
Looks like some people just love rewriting their OSes over and over.
What is wrong with C++? What problems did you run into? I've recently (~5 months ago) switched to C++ and things are definitely easier to work with and organize.
Nah, don't go micro yet, that is a really big big switch IMHO, lots of specific things to consider.
It wasn't so much that I had a problem with C++: I love the language, and it can be extremely expressive. If you excuse the ridiculous naming conventions of its standard library, it's incredibly powerful too.
The problem I found was that I got bogged down in details. I'd write my own implementation of std::vector. It would work, but then I'd realise a month down the line that there was a bug in it. I'd go back to fix that, and this became a common thing. The more I tried to create abstractions: automatic reference counting, smart data structures, etc. the more time I consumed working on things that weren't core features of the OS. I got myself stuck in a pit where, for about 2 months, I added virtually no new features to my OS, instead spending my time improving and adding needless overhead to my kernel in an effort to produce correct code.
I moved to C, and things are much nicer. Most code is actually shorter, it doesn't do strange things in the background, you mostly don't have to care about constructing static objects, it doesn't mangle function names (putting 'extern "C"' at the beginning of stuff gets boring very quickly), and the syntax is SO simple that it feels more like you're working with the underlying machine rather than the language. Its syntax seems to be designed to just get out of the way, without any distractions like OO, templating, constexpr, lambda functions, global construction, etc.
My conclusion is this: C++ is superb for userland applications. But for my kernel, I'm going to use C for sure.
I think the same thing.
I'm gonna use C and Assembly for kernel stuff, port some small C compiler for user land ... and that is it.
C++ is a nightmare. I simply can't handle that language at this moment.
Maybe in the future.