4 ms·
Lots of replies kind of missed my point (my fault, probably) - I think there are cases where 'int' is the correct type to use, and cases where it is not. I thin
by jjnoakes 3y ago
Lots of replies kind of missed my point (my fault, probably) - I think there are cases where 'int' is the correct type to use, and cases where it is not. I think using 'int' everywhere is probably a mistake, and using 'int' nowhere is probably also a mistake.
Sometimes you are working within the guaranteed bounds of an 'int' in the C standard, so portability isn't an issue. Sometimes you are mixing different types and want to capture intermediate values in the promoted type, which is dictated by the C standard. Sometimes you want to use the native machine word for a good reason. And sometimes it is just easier to read and reason about (printf-like conversion specifications, code that interfaces with POSIX APIs frequently, etc).