4 ms·
Not the author, but the thing that got me interested in the project was some posts the author made on OSDev[0] about trying to minimize the amount of interdepen
by abenedic 9y ago
Not the author, but the thing that got me interested in the project was some posts the author made on OSDev[0] about trying to minimize the amount of interdependencies in the libc code. A lot of the kernel is written in C++[1] which is a little rare (Haiku, and what else?). They also have a cleaned up zlib that I have used and think is quite nice[2]. Also I almost forgot about os-test[3] which tests POSIX compatibility.
[0]https://wiki.osdev.org/User:Sortie/Sortix_Thread_Local_Storage https://wiki.osdev.org/User:Sortie/Sortix_Thread_Local_Stora...
[1]https://gitlab.com/sortix/sortix/tree/master/kernel https://gitlab.com/sortix/sortix/tree/master/kernel
[2]https://sortix.org/libz/ https://sortix.org/libz/
[3] https://sortix.org/os-test/ https://sortix.org/os-test/
- jf 9y agoos-test is really cool, thanks for the additional links!
- chasil 9y agoLinus Torvalds had (in)famous commentary on the use of C++ within kernel design. http://harmful.cat-v.org/software/c++/linus http://harmful.cat-v.org/software/c++/linus I wonder if things have changed in the decade since he penned that.
- metalliqaz 9y agoFrom the link: Quite frankly, even if the choice of C were to do *nothing* but keep the C++ programmers out, that in itself would be a huge reason to use C. lol, thanks for that
- sifoo 9y agoPerl6 has Camelia (https://perl6.org/ https://perl6.org/) for much the same reasons. It's everywhere once you start looking for it. I've taught Ving Tsun Gongfu for about 25 years; used to have fancy uniforms, grades and walls covered with certifications; and put a lot of effort into entertaining people and stroking their egos. These days I'll rent whatever shabby room, show up in regular clothes and focus on teaching the real deal; the people who are in it for the right reasons don't care.
- renox 9y agoUnfortunately I think that this statement has some truth in it: I work in telecoms where we care about realtime: I was used to work in C but my latest project is in C++, I was curious about how C++ and realtime mix: the answer is quite poorly.. It's not that you can't do realtime in C++: it's that you have to fight against lots of C++ developers who want to apply the non-realtime C++ popular idioms. For example: using interface classes for mocking objects with googletest, the result: virtual methods everywhere..
- jcranmer 9y agoWell, the newer comment basically amounts to "Real programmers know to use C, so we keep the uncultured plebes out." Which isn't really any argument against using C++, but is rather the kind of attitude that should be expunged from system developers. There are reasons to avoid using C++: * The main benefit of C++ is that it has a standard library that's somewhat usable. Except you can't use standard libraries anyways in kernel code. * Templates, particularly as they intersect with name lookup, are difficult semantics both to the compiler and the user. Until a decade ago, using templates meant more or less playing roulette as to which compilers could handle it correctly. * RTTI and exceptions are broken features. It has more or less been accepted that these features are optional in C++. * The famous saying goes "there's a safe subset to C++, but no one agrees what that subset is." That's still more or less true today. The main advantage of C++ is that it gets you RAII (which makes dealing with errors much easier, since you're less liable to have issues like gotofail), and you can use templates to build safer ADTs. These are strong benefits in that it's a lot harder to make mistakes as a developer, but there is a strong tendency in this corner of systems developer to assume that stupid mistakes are a fault of the programmer and not the language, and so such benefits are considered flaws because it means letting in stupid people.
- msla 9y ago> but there is a strong tendency in this corner of systems developer to assume that stupid mistakes are a fault of the programmer and not the language, and so such benefits are considered flaws because it means letting in stupid people. I don't disagree with you, but I think I can steelman Torvalds' position a little bit: Low-level development is touchy. If you're not extremely careful, you're going to make errors which no language could possibly prevent, which could very well hard-brick some poor schlub's gear. Selecting for people who know the most "be careful" of all the "be careful" languages means selecting for people who are at least somewhat less likely to make errors like those.
- flyingfences 9y ago> "Real programmers know to use C, so we keep the uncultured plebes out." ... is rather the kind of attitude that should be expunged from system developers. I have to disagree in this case. I think the rationale here is that a working, productive mastery of C suggests a developer of a certain caliber. For many projects you would be right, it would be good to encourage the more junior developers to join the project. But, for the Linux kernel, for the core of one of the most widely-deployed pieces of software on the planet, the foundation of countless systems, many of which are performing critical functions, I, frankly, think it's good to filter the dev team for properly competent devs at every possible juncture. If rejecting C++ keeps the noobs out, that's a good thing.