this post was submitted on 14 Nov 2023
5 points (100.0% liked)

Apple

67 readers
2 users here now

A place for Apple news, rumors, and discussions.

founded 11 months ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 10 months ago (5 children)

Why use a signed integer for something strictly non-negative (ignoring bugs ofc)?

[–] [email protected] 1 points 10 months ago (1 children)

It doesn’t really make sense especially since other apps like mail just say idk 9999+ at some point (maybe higher or lower, I’m no maniac letting it get there)

[–] [email protected] 1 points 10 months ago

It's just rounded down to 9999 in the ui but internally the exact number is still counted

[–] [email protected] 1 points 10 months ago

Ask that question to Java

[–] [email protected] 1 points 10 months ago

Some developers get lazy and just use an int for everything it's not really a big deal anyway

[–] [email protected] 1 points 10 months ago

It's always better to use signed for absolutely everything unless you're dealing with a very edge case

[–] [email protected] 0 points 10 months ago (1 children)

Because it is all written in a language that only has signed numbers. That's virtually all modern languages.

[–] [email protected] 1 points 10 months ago

Swift (used for Apple devices) has them (see the Integers section):

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/thebasics/

So it was actually written in a language that has them...

C# has them (goes without saying)

Java doesn't seem to.

This is still clearly far from "virtually all."