• litchralee@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    13
    arrow-down
    1
    ·
    edit-2
    13 hours ago

    I read this, and thought it was kind of all over the place. Even the first “falsehood” about always immediately crashing is answered as “true for some languages but not some others”. Even the motion of superlatives in CS like “always” and “never” rarely hold, including this very sentence and almost certainly when talking about multiple programming languages.

    And on that point, it’s a minor quibble, but while Go’s nil pointers are similar to C null pointers and Rust’s null raw pointers, it’s a strange thing to have the title be about falsehoods about null pointers.

    But then much of the other supposed falsehoods are addressed only for the C language, such as null deference being UB or not.

    1. On platforms where the null pointer has address 0, C objects may not be placed at address 0.

    I would like to see a ©itation [pun intended] for this being a supposed falsehood, since my understanding is that if an implementation uses 0x0 as the null pointer, then the check for a null pointer is to check if it’s equal to 0x0, which would require that no “thing” in C use that address.

    • marcos@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      17 hours ago

      I’m almost sure storing data at *(0) is undefined behavior, so yes, that falsity #9 is indeed false.

      Also, many embedded toolsets expect you to write there.