3 ms·
I would use ssize_t instead of size_t. Mixing unsigned and signed is seriously broken in C, and hence better to stick with signed.
by towergratis 5y ago
I would use ssize_t instead of size_t.
Mixing unsigned and signed is seriously broken in C, and hence better to stick with signed.
- minipci1321 5y ago> Mixing unsigned and signed is seriously broken in C, and hence better to stick with signed. Mmmm .. maybe in this specific case (didn't look). But if you meant this as general advice, then one should keep in mind that unsigned overflows are specified but signed overflow is UB (barring maybe the very latest version of C standard); because of that, unsigned division in many cases is trivially optimised to less complex ops, etc. There are many advantages in using unsigned.