1487
oddly specific (lemmy.blahaj.zone)
submitted 4 weeks ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 16 points 4 weeks ago* (last edited 4 weeks ago)

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

[-] [email protected] 32 points 4 weeks 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.

[-] [email protected] 3 points 4 weeks ago

Fair, sounds reasonable

[-] [email protected] 2 points 3 weeks ago
[-] [email protected] 1 points 3 weeks ago

Unless it's lua, then screw anyone programming with it.

Have to use lua for my current project and the 1-based indexing is really screwing with me.

[-] [email protected] 24 points 4 weeks ago

Right but having a group chat of size 0 isn’t very useful.

[-] [email protected] 12 points 4 weeks 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.

[-] [email protected] 2 points 4 weeks ago

I don't think it's the variable for counting the number of us in a group that's the issue here. There'll be some internal tracker that gives everyone in the chat group a local ID probably for the purposes of ensuring that everyone stays in sync.

If you leave the group and then go into a different chat group you'll probably have a different number in that group because the internal counter is specific to the chat, not to the user ID which will be a unique ID used across all interactions for that phone number.

[-] [email protected] 1 points 4 weeks ago
[-] [email protected] 18 points 4 weeks ago

one person, and 255 would represent 256 people

[-] [email protected] 11 points 4 weeks ago

The first index

[-] [email protected] 6 points 4 weeks ago

The limit isn't on the actual count of people, it's likely the size of the chat user id number.

[-] [email protected] 19 points 4 weeks ago

And programmers usually start counting at 0.

[-] [email protected] 10 points 4 weeks ago

Your thinking indexing, 0 is still 0 when counting.

[-] [email protected] 11 points 4 weeks ago

The number of distinct values are what matters.

[-] [email protected] 7 points 4 weeks 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.

[-] [email protected] 2 points 4 weeks ago

Computers start counting at zero, (unless it's python) so the first person in the group would be ID 0, the second person would be ID 1

[-] [email protected] 3 points 4 weeks ago

At a basic level python normally counts from zero (indices as an example)

this post was submitted on 07 Jul 2025
1487 points (99.1% liked)

Microblog Memes

8778 readers
2318 users here now

A place to share screenshots of Microblog posts, whether from Mastodon, tumblr, ~~Twitter~~ X, KBin, Threads or elsewhere.

Created as an evolution of White People Twitter and other tweet-capture subreddits.

Rules:

  1. Please put at least one word relevant to the post in the post title.
  2. Be nice.
  3. No advertising, brand promotion or guerilla marketing.
  4. Posters are encouraged to link to the toot or tweet etc in the description of posts.

Related communities:

founded 2 years ago
MODERATORS