• GissaMittJobb@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    9 months ago

    Having an asterisk both be the type indicator and the dereference operator is one of the great programming language design blunders of our time, along with allowing nulls for any type in so many languages.

    • darkpanda@lemmy.ca
      link
      fedilink
      arrow-up
      0
      ·
      9 months ago

      I also sometimes wish that the syntax in if statements was inverted, where () was optional and {} was required.

    • sweng@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      9 months ago

      You would think so, but int* a, b is actually eqivalent to int* a; int b, so the asterisk actually does go with the name. Writing int* a, *b is inconsistent, so int *a, *b is the way to go.