1. 12

[…] Genode’s C++ dialect evolved primarily from an economic perspective. Earlier in the project, when haunted by memory-corruption problems or sporadic data-race conditions, operating-system development sometimes felt like the misery of spending only a miniscule fraction of the day with creating new and exciting things while 95 percent of the time went down the drain with the question: What the heck is going on? Worse, the most obnoxious bugs turned out to be shamefully mundane. Finding such an issue did not felt like a victory but rather a defeat. A missing lock guard, an off-by-one, a missing virtual destructor, an arithmetic overflow, or an uninitialized variable - a tiny artifact left in a weak moment and overlooked by reviewers - ensued sometimes days of hunting. […] Over the years, a stringent and strongly opinionated dialect of C++ evolved, which dramatically improved the situation.

Note: this is a “part 1” article; hopefully there’s more of those to come from Norman Feske.

  1.  

  2. 4

    There’s some overlap with Foundation DB’s use of C++:

    • pure dependency injection with “env” (although neither of them use that term. For the functional programmers, it’s like Haskell’s IO as far as I understand.)
    • async I/O only

    Additionally, Foundation DB uses a C++ translator that turns coroutines into state machines. (Genode also seems to be based on state machines.)

    I highly recommend this Strange Loop talk on Foundation DB:

    “Testing Distributed Systems w/ Deterministic Simulation” by Will Wilson

    I missed it the first time around because the title didn’t catch my eye… but it is a very interesting and unique database design.

    1. 3

      I went looking for a tool that could compile this C++ dialect (or at least validate that an existing program strictly follows the dialect), and I came across this C++ parser in TCL:

      https://github.com/genodelabs/genode/blob/master/tool/parse_cxx

      I wonder how complete it is?

      1. 1

        That is interesting… it’s only 912 lines, and it says it’s a “regex-based parser”, so it looks like the minimal thing to do the job.

        I’m interested in C++ dialects though. It would be nice if C++ was more customizable to a particular application, like Genode and Foundation DB as I mentioned in the other comment here. I’m generating C++ code for Oil and it would be nice to constrain it to a well understood dialect.