News for hackers. Stuff that matters.
Re:Almost Always Unsigned by whattheactualf3 on Sunday January 02, 2022 @07:22AM (#29768155)
Is it called "unsigned" though?

In Racket (and in mathematics) we call those natural numbers. The very notion of "unsigned" was invented by video game programmers at Bell Labs. In mathematics positive numbers are still signed (they just have a positive sign).

Re:Almost Always Unsigned by masklinn on Sunday January 02, 2022 @08:51AM (#29768685)
> Is it called "unsigned" though?

Yes: https://doc.rust-lang.org/std/primitive.usize.html

> The pointer-sized unsigned integer type.

> In Racket (and in mathematics) we call those natural numbers.

Naturals have no upper bound. Most languages don't have naturals, because they do have upper bounds. Languages which do provide naturals (limited by the host machine) usually don't bother with signing segregation, and give you mathematical integers (again limited by the host machine's capabilities).

Re:Almost Always Unsigned by gumby on Sunday January 02, 2022 @07:52AM (#29768338)
> The very notion of "unsigned" was invented by video game programmers at Bell Labs.

PL/I had (has) unsigned integers back in the 60s, picking up the idea from earlier languages. I believe the novel datatype in PL/I was the CHARACTER type; into the 80s I was still programming machines with variable length bytes.

In many ways PL/I heralded the current Ordovician stage of programming languages, with the enormous Cambrian flourishing of hardware-specific (and company-specific) languages slowly dying out. Interestingly the only surviving languages older than it, FORTRAN and LISP, are also machine-independent.

Re:Almost Always Unsigned by ncmncm on Sunday January 02, 2022 @05:54PM (#29774978)
Unsigned types are supported in machine language.

Any language that offers access to features of the machine will support unsigned numeric types.

No language supports natural numbers. The best you can get is bignums. A language that calls its numbers natural is just lying. (Likewise, integers, and reals.)

"int" is not a lie, it is a hint.