• Mr. Satan@lemmy.zip
    link
    fedilink
    English
    arrow-up
    16
    ·
    edit-2
    1 month ago

    Wouldn’t max value for 8 bit (unsigned) integer be 255? Like the number has 256 distinct values, but that includes 0.

    • squaresinger@lemmy.world
      link
      fedilink
      English
      arrow-up
      31
      ·
      1 month ago

      If this is about a counter for users in the chat, sure. But if this is an array of users indexed by an 8-bit number, then it will fit 256 slots with the first slot being numbered 0.

      • khapyman@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        11
        ·
        1 month ago

        Not to be snarky, in programming there’s rarely (in situations like this) a reason to keep count. Computers are exceptionally good at counting integers so they’d just count individual client id’s (however they’ve implemented that system), not keeping toll on how many clients are in a group chat.

        So one client, be it at position zero is a one client group. Add another client at position one and you have two clients and a two person group.

    • Alaknár@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      7
      ·
      1 month ago

      You’re thinking of the highest integer number, not the “number of numbers” - which is 256, from 0 to 255, and thus 256 possible users in a group chat.