Live data from Hacker News

Thor – A minimalistic operating system in assembly and C++

github.com

11–20 of 152 posts

Re: Thor – A minimalistic operating system in assembly and C++

#11
post #10
post #6

Earlier quoted context omitted.

It's a really annoying widespread opinion. I've been looking for people who really do write OSes in modern C++.

IncludeOS? [0] From the CppCon 2016 presentation description: "Early in the design process we made a hard choice; no C interfaces and no blocking POSIX calls. We’ve done everything from scratch with modern C++ 11/14 - Including device drivers and the complete network stack all the way through ethernet, IP and ARP, up to and including UDP, TCP and recently also an http / REST API framework. To achieve maximum efficien…

Nice :) I didn't know this project. I'll definitely read about this project.

Re: Thor – A minimalistic operating system in assembly and C++

#12
post #8
post #4

Earlier quoted context omitted.

That's Linus's opinion, yes. Not everyone has to share it.

Yes, but his opinion counts more than some John Doe's as Linus supports his case with solid arguments.

'It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. 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'

Solid argument that.

His two other arguments:

- infinite amounts of pain when they don't work (and anybody who tells me that STL and especially Boost are stable and portable is just so full of BS that it's not even funny)

Considering that the linux kernel is strongly tied to the specific C dialect supported by GCC and is not portable at all, this argument is bullshit.

- inefficient abstracted programming models where two years down the road you notice that some abstraction wasn't very efficient, but now all your code depends on all the nice object models around it, and you cannot fix it without rewriting your app.

You can abstract yourself in a corner in C as well. In C++ you are more likely to pay less for abstractions.

Sorry, but I take it personally when me and my colleagues are called substandard programmers.

Re: Thor – A minimalistic operating system in assembly and C++

#13
post #3

An OS in C++? But Linus said... http://harmful.cat-v.org/software/c++/linus

As other's have stated, that is just Linus's opinion, which he is entitled to. It's also even understandable given his position managing all of the Linux kernel and git development work, and the large number of people who contribute (or try to anyways...) If you don't want people to blow their damn leg off, don't give them a shotgun (http://programmers.stackexchange.com/questions/92126/what-di...).

That said, this absolutely doesn't mean that you CAN'T do systems level programming in C++. I've actually done real RTOS and motor control work on a small embedded platform that went in a robot using C++! This is in an actual shipping product too, not just a hobby project...

As Linus said, it's definitely easier to come up with something inefficient in C++, and you do have to limit yourself to a sane set of features. That said, I think some of the things C++ brings to the table can make development a lot easier without sacrificing performance as long as you have a disciplined team and sane coding guidelines. But what makes sense for a personal project or a small team may not make sense for a larger project, and while I think Linus is justified in his opinion, you definitely shouldn't take it to mean that you CAN'T do systems programming in C++.

Re: Thor – A minimalistic operating system in assembly and C++

#15
post #3

An OS in C++? But Linus said... http://harmful.cat-v.org/software/c++/linus

The problem with C++ is more about collaboration than with the language. It's harder to misuse C than C++. When you have a large group of people contributing, proper usage matters. Everything Linus rants about is improper usage.

Re: Thor – A minimalistic operating system in assembly and C++

#16
post #8

Earlier quoted context omitted.

Yes, but his opinion counts more than some John Doe's as Linus supports his case with solid arguments.

'It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. 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' Solid argument that. His two other arguments: - infinite amounts of pain when they don't work (and anybody who tel…

> You can abstract yourself in a corner in C as well.

It's much, much harder to do than in C++. It's also much more obvious when it happens, and in collaboration others will spot it quickly.

His tone is harsh but I find it completely right. I prefer to use C at work exactly because the same kind of software would be an absolute nightmare to write in C++ (it is very low-level soft, extremely similar to kernel code).

C++ is good if you can enforce very strict guidelines and if every single programmer that contributes to the code is very good at C++. Those are pretty big if, especially if you work with a partially open source codebase.

Re: Thor – A minimalistic operating system in assembly and C++

#18
post #3

An OS in C++? But Linus said... http://harmful.cat-v.org/software/c++/linus

Aren't large parts of Windows written in C++ ?

I'm pretty sure it is! ( I'm also pretty sure that for a subset of the HN crowd, you may have just proven Linus's point :-P )

Re: Thor – A minimalistic operating system in assembly and C++

#19
post #6
post #4

Earlier quoted context omitted.

That's Linus's opinion, yes. Not everyone has to share it.

It's a really annoying widespread opinion. I've been looking for people who really do write OSes in modern C++.

Genode (essentially a microkernel abstraction layer, and some useful userland, a full Qt implementation and a reasonable UNIX-y layer) is entirely C++, with some C++ microkernels available for it (Fiasco.OC and Nova being the two I'm playing with).

Re: Thor – A minimalistic operating system in assembly and C++

#20
post #8

Earlier quoted context omitted.

Yes, but his opinion counts more than some John Doe's as Linus supports his case with solid arguments.

'It's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it. 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' Solid argument that. His two other arguments: - infinite amounts of pain when they don't work (and anybody who tel…

As long as you avoid "virtual", I can't even think of any C++ features which would lead you towards worse performance characteristics than C.

Templates may bloat your binary size and increase compile times, but they're plenty fast.

Post reply on HN