Any guaranteed minimum sizes for types in C?
c, cross-platform, types
Solution
This is covered in the Wikipedia article:
A `short int` must not be larger than an `int`. An `int` must not be larger than a `long int`.
A `short int` must be at least 16 bits long. An `int` must be at least 16 bits long. A `long int` must be at least 32 bits long. A `long long int` must be at least 64 bits long.
The standard does not require that any of these sizes be necessarily different. It is perfectly valid, for example, if all four types are 64 bits long.
Problem
Can you generally make any assumptions about the minimum size of a data type? What I have read so far: - char: 1 Byte - short: 2 Byte - int: 2 Byte, typically 4 Byte - long: 4 Byte float??? double??? Are the values in `float.h` and `limits.h` system dependent?