For example, int takes 4 bytes on a 32-bit OS, but 8 bytes on a 64-bit OS, does this kind of thing exist in C?
Yes. This is precisely what is meant by "platform-specific definitions" for things like the size of int and the meaning of system calls.
They depend not just on the OS, but also on the target hardware and compiler configuration.
It can depend on the OS, but more typically it depends on the hardware. Many micro controllers still use 16-bit int:s, since this is what the device handles naturally.
While we're in the subject. This does not only affect the int type, it also affects how expressions are evaluated. The principle is that every expression is evaluated as though it would have been evaluated in int precision, or larger. For example, given two 16-bit short variables a and b and a long variable x, the expression x = a*b will yield different result depending on the size of int, even though none of the involved variables have the type int.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With