2 ms·
Not when you are writing the Linux kernel, when you know exactly which sizes the integers are. Or even when you are writing low-level code on a known platform
by kccqzy 6y ago
Not when you are writing the Linux kernel, when you know exactly which sizes the integers are.
Or even when you are writing low-level code on a known platform (e.g. an LP64 platform).
- peterwwillis 6y agoAll the typical sizes depend on the compiler and the flags you provide. If you provide the wrong flags, the sizes of each type may change, but you won't see any warnings about it because it's expected behavior, and now you've got different binaries with different behavior. Or you could use fixed-width types and if the wrong flags get passed (no C99 support) your code just doesn't compile. I just checked the Linux kernel style guide, and they explicitly suggest you can use fixed-width types from C99 when it makes sense. I get that they want a balance for their project, but for general programming, it's just safer to be explicit. https://www.kernel.org/doc/html/v5.1/process/coding-style.html#typedefs https://www.kernel.org/doc/html/v5.1/process/coding-style.ht...