3 ms·
signed/unsigned stuff predates C, though. My (lack of) experience with C came much later, when I had used assembly for 3 different CPUs already, so no recollect
by xxs 5y ago
signed/unsigned stuff predates C, though. My (lack of) experience with C came much later, when I had used assembly for 3 different CPUs already, so no recollection of the times.
- int_19h 5y agoIf you mean the default being signed, it's there because B - the predecessor of C - only had a signed integer (machine word) type. But note that this is about the case when the variable has no type at all - e.g. "auto x" is a signed int. They still had the choice of "int x" being equivalent to either "signed int" or "unsigned int" by default, though - since there's no backwards compatibility issue there - and chose signed. FWIW, signed seems to be the default for most other languages from that time period, and often the only option - e.g. Algol-60 didn't have unsigned integers at all. Pascal kinda sorta did, if you defined an integer subtype with 0 as the lower bound... but the upper would still be that of signed int, and it'd behave as such. And Algol-68 called its unsigned type BITS - a pretty strong hint that they didn't think of it as arithmetic. I'm actually kinda curious now as to when the concept of unsigned integers first appeared in a high-level programming language first.