Re:Using signed or unsigned int by default in C (2015)
by 10000truths on Tuesday August 23, 2022 @01:27PM
(#32568172)
I would rather just use a plain for loop and manipulate the index in the loop body:
Much easier for me to understand, making it less likely to mess anything up.
[ Parent
| on HN ]
Re:Using signed or unsigned int by default in C (2015)
by edflsafoiewq on Tuesday August 23, 2022 @01:32PM
(#32568239)
You'll need a new variable there, but otherwise yeah.
Re:Using signed or unsigned int by default in C (2015)
by WalterBright on Tuesday August 23, 2022 @03:07PM
(#32569725)
Even easier (for D):
foreach (i; 0 .. length)
D takes care of selecting the correct type for `i`.