• within_epsilon@beehaw.org
    link
    fedilink
    arrow-up
    4
    ·
    6 days ago

    New feature with terrible syntax. There are features of every language I choose not to use. As a C++ developer, I would choose not to use this syntax, so that my team can write better designed code. However, I am an oddball on my team for loving trailing return types. In peer review, the schlong operator i.e. ---> would only be used where it makes sense which should be nowhere.

    Peer reviewing this seriously would require knowing more context. Instinct tells me MyClass**** is probably allocated from the heap. A possible reason for so many levels of indirection are jagged arrays. Maybe the function only gets the first element of each level of the arrays. The function name doesn’t make that clear. This is poorly designed. Please re-design/re-write. I will happily review those changes. I expect unit tests to show example use cases.

    I would suggest using a stack allocated array with sentinels for missing values to improve cache coherency. Without context, I assume looping over the jagged structure will be common. Loading more into cache should improve efficiency in loops, but benchmarks are required.

    Wait… I should join the crowd. So I say, “down with C++” and up with some safe alternative. Maybe rust: https://github.com/Speykious/cve-rs.

    • socsa@piefed.social
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 days ago

      Best i can imagine, this is what happens if you are terrified of smart pointers, but also want to make all object pointers scope specific. So at every layer of hierarchy, you have a unique reference to some partial implementation above and below it.

      Honestly I struggle to imagine any real scenario where this would make sense… except maybe like some kind of insane recursive factory.