libera/#lisp - IRC Chatlog
Search
18:45:19
aeth
Outside of Linux, where Linus famously hates C, I think that C++ is generally preferred even in kernels. Rust has probably taken a lot of the hype to the point where a ton of newer OS stuff would be written in Rust if started today, but most pre-existing kernels are probably C++ now, including parts of the NT kernel (as much hate as Windows gets, the junk is on the *higher* layers).
18:46:30
aeth
You can't use all of C++ at the lowest levels, but C++ offers a lot of nice things that C doesn't because C's so basic. But the really old C stuff like the Linux kernel wrote most of those sorts of things as libraries ages ago by now, so it's mostly equivalent besides uglier syntax (which is saying something given how ugly C++ is).
18:47:08
aeth
Except, you can't see the source of those kernels and Linux is all-C and is the most popular FOSS kernel so people associate C with kernels.
18:53:04
fourier
Interesting to see what is inside vxworks or qnx, but I suspect they are in c as well
18:54:17
aeth
well, traditional embedded systems are probably very close to the 80s or early 90s systems that rejected C++ for performance reasons!
18:54:44
aeth
although these days a lot of "embedded" really just exists to make the Raspberry Pi supply unavailable to home users even if the pi is complete overkill :-p
19:00:50
jcowan
One of the first results comparing assembler to HLLs found that the number of bugs per LOC is basically constant, so even a simple-minded HLL that gets 2-3 instructions per LOC weeds out 50-66% of bugs
21:27:59
aeth
which is why stuff like godbolt.org exists (but in CL, you can just DISASSEMBLE, and don't need such a web tool)
21:30:10
aeth
and people generally use C because it's fast, so turning off optimizations is probably not an option
22:12:02
White_Flame
johnjaye: not really, there's no carry etc flags, the function call semantics & local variables are fixed, and a lot of stuff that's useful in actual asm coding isnt' exposed