Live data from Hacker News

Writing New System Software

borud.no

81–90 of 158 posts

Re: Writing New System Software

#81
post #36

Earlier quoted context omitted.

> (...) such as Google's famous "no exceptions". If I recall correctly, Google's rationale regarding exceptions is that their legacy code is not exception-safe, and so they were faced with the choice of either rewriting critical parts of their legacy code to handle exceptions, or don't use them. Also, their "no exceptions" rule only applied to work involving their legacy code. I'm too lazy to find the source, but tha…

Indeed the details matter, but my example was just designed to be something that might be somewhat more recognizable than those situations and restrictions I've encountered personally.

> (...) my example was just designed to be something that might be somewhat more recognizable (...)

If your goal was to use that poor example to support the idea that people stick with subsets of C++ because of reasons, that example failed to support the assertion. Thus it makes no sense to stick with a patently wrong observation just because it's easier to recall.

Getting back to the topic, as far as I know there are only two features of C++ which are up for debate regarding their adoption: exceptions, and template metaprogramming. The exception-handling debate only makes sense in very low-level applications and refactoring legacy exception-less code, which in practice is not anyone's case. The template metaprogramming debate typically boils down to YAGNI and the need to avoid resume-driven development. Nevertheless, both features are used extensively, whether directly or indirectly (see STL), and in general there is no reason to bother debating whether people should use it or not, unless you have very specific requirements in mind (I.e., avoid generating magical code in embedded applications, or in very high performance applications where you feel you need tight control over everything down to which instructions are generated).

Re: Writing New System Software

#82

Is it me or is this essay really an incoherent mess? As much as I would like to agree with the author's stern verdict (and I am saying this as a systems programmer with more than 20 years experience) I cannot make out the central argument.

The central argument is that C/C++ is not worth the trouble for new code and that using it "correctly" is a theoretical thing that even experts struggle with. C/C++ programmers keep on insisting that they've found ways to do it right, finally. Some C/C++ programmers seem to believe that, unlike everybody else, they actually have the combination of wisdom, skills, and discipline to not fall into this trap. At this poi…

[deleted]

Re: Writing New System Software

#83
post #69

Earlier quoted context omitted.

I agree. But I also think that the following two language features are important: 1. Polymorphism 2. Specialization of code and data structures Both aspects only go well together with global compilation which basically enforces static linking, unless you either substantially improve the ABI or introduce some artificial language limits regarding composition. Personally, I think that it should be possible to extend the…

This is hilarious: someone comments about a real problem that requires a practical solution in a programming language, and someone invariably rushes to add their subset of “nice to have” language features.

Well motivated choices though. Polymorphism reduces lines of code, which are correlated with bug count. Reliability is essential for critical system software.

Specialization eliminates nearly all overhead of polymorphism so there's no disincentive against using it.

Re: Writing New System Software

#84
post #40

There are multiple types of system software, and it wasn't specified which. If you're talking about Embedded or Kernel Systems, writing a layer that can efficiently and securely multiplex and abstract the hardware requires a much different set of tools than the rest of the system. Here I disagree with the author. Once you're no longer concerned with directly probing the hardware, it seems far more appropriate to worr…

All the mechanisms provided by C and C++ to directly probe the hardware are compiler extensions. Any language can have compiler extensions. Heck we used to do it in BASIC.

Memory mapped I/O is pretty standard and doesn't really require special compiler support in principle.

Re: Writing New System Software

#85
post #6

I tend to disagree. (Modern) C++ is an incredibly powerful programming language. Contrary to some other languages it gives the developer maximal freedom and does not impose a particular way of doing things on the developer.

> Contrary to some other languages it gives the developer maximal freedom and does not impose a particular way of doing things on the developer

You seem to be implying that's a good thing. It's literally not.

Imagine if I created a programming language where every random string of characters was a valid program (cue the Perl jokes). Clearly this language permits even more freedom than C++, but this would be a nightmare for programming.

Constrained structure is essential to programming. Sometimes you need to beyond the constraints of a more common language, in which case C++ might be a good choice, but that's the exception not the rule.

Re: Writing New System Software

#86
post #66

The Rust propaganda is getting more subtle I see ;) It's only mentioned once towards the end of the post together with Go and Java. What a clever disguise.

Strange language choices for a Rust propagandist's GitHub repositories: https://github.com/borud?tab=repositories

Part of the maskirovka no doubt ;)

Re: Writing New System Software

#87
post #40

Earlier quoted context omitted.

All the mechanisms provided by C and C++ to directly probe the hardware are compiler extensions. Any language can have compiler extensions. Heck we used to do it in BASIC.

Memory mapped I/O is pretty standard and doesn't really require special compiler support in principle.

If we go down that path, that is also nothing special about any of the C languages.

Re: Writing New System Software

#88
post #64

The Rust propaganda is getting more subtle I see ;) It's only mentioned once towards the end of the post together with Go and Java. What a clever disguise.

The Rust propaganda or the anti-secure software propaganda that always starts to complain about Rust when one talks about writing safe software, regardless of which languages are suitable for such use cases since 1958?

> (...) anti-secure software propaganda (...)

Enough with this cargo cult belief system. Even if your choice of bicycle has training wheels, you can still fall down and scrape your knees if you don't know what you're doing.

I mean, Rust already has a few CVEs for use-after-free vulnerabilities, which this cargo cult swears are rendered impossible.

Just stick with your personal choice of worktool and own it. It's not the guardrails that stop you from crashing, but the way you drive.

Re: Writing New System Software

#89
post #88
post #64

Earlier quoted context omitted.

The Rust propaganda or the anti-secure software propaganda that always starts to complain about Rust when one talks about writing safe software, regardless of which languages are suitable for such use cases since 1958?

> (...) anti-secure software propaganda (...) Enough with this cargo cult belief system. Even if your choice of bicycle has training wheels, you can still fall down and scrape your knees if you don't know what you're doing. I mean, Rust already has a few CVEs for use-after-free vulnerabilities, which this cargo cult swears are rendered impossible. Just stick with your personal choice of worktool and own it. It's not…

My personal tool for writing safe software isn't Rust, but here we are, recycling arguments as if that is the only option available.

Re: Writing New System Software

#90

Is it me or is this essay really an incoherent mess? As much as I would like to agree with the author's stern verdict (and I am saying this as a systems programmer with more than 20 years experience) I cannot make out the central argument.

The central argument is that C/C++ is not worth the trouble for new code and that using it "correctly" is a theoretical thing that even experts struggle with. C/C++ programmers keep on insisting that they've found ways to do it right, finally. Some C/C++ programmers seem to believe that, unlike everybody else, they actually have the combination of wisdom, skills, and discipline to not fall into this trap. At this poi…

> Apple created Swift to get rid of object C.

But even Apple still notes that you should not write audio processing code in Swift, and if you use Objective C for this purpose, to avoid the Objective parts of it.

Post reply on HN