Re:Using signed or unsigned int by default in C (2015)
by phkahler on Tuesday August 23, 2022 @01:38PM
(#32568319)
I'd argue that is a terrible way to write it since it depends on the rollover to terminate. Using i >= 0 is less mental work but also requires that i be signed.
[ Parent
| on HN ]
Re:Using signed or unsigned int by default in C (2015)
by ghoward on Tuesday August 23, 2022 @01:40PM
(#32568370)
Rollover on unsigned ints is well-defined in C.
Re:Using signed or unsigned int by default in C (2015)
by hbn on Tuesday August 23, 2022 @03:36PM
(#32570240)
I think their point is that it's less well defined in the average human's brain
When most people see 0 - 1 they don't immediately think 11111111111111111111111111111111
Re:Using signed or unsigned int by default in C (2015)
by ghoward on Tuesday August 23, 2022 @05:09PM
(#32571551)
We're talking about C, though. I hope the average human is not writing C.
Re:Using signed or unsigned int by default in C (2015)
by jcelerier on Wednesday August 24, 2022 @04:17AM
(#32576313)
the average person writing C is absolutely an average human in terms of relationship with mathematics