• space_comrade [he/him]@hexbear.net
      link
      fedilink
      English
      arrow-up
      6
      ·
      edit-2
      2 years ago

      Counterpoint: using anything other than ‘i’ as your index in a for loop in C or C++ is obnoxious as fuck.

      At most I’ll go with ‘it’ for C++ iterators.

    • verstra@programming.dev
      link
      fedilink
      arrow-up
      6
      ·
      2 years ago

      I have a convention to correlate the size of variable scope with its name length.

      If a variable is used all over the program, it will be named “response”. If it is <15 lines, then it can be “res”. If it is less than 3 lines, it can be only “r”.

      This makes reading code a bit simpler, because it makes unimportant, local vars short and unnoticeable.

    • jvisick@programming.dev
      link
      fedilink
      arrow-up
      6
      ·
      2 years ago

      Mostly agree. I’m ok with single characters in a one line / single expression lambda, but that’s the only time I’m ok with it.

    • uralsolo [he/him]@hexbear.net
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 years ago

      I understand this conceptually, but there’s also a gremlin in my brain that wants me to make every line as short as possible.