Fixed Width Chain Types C99

It is not possible to get a detailed answer to my question here . I thought I would do it from a different angle.

Can anyone explain what selection criteria are used to determine the base types for integer types of fixed width C99:

[u]int_fast[n]_t
[u]int_least[n]_t
[u]int[n]_t

For a given processor, if "long" and "int" are the same size (sizeof (int) == sizeof (long)), then why "long" will be used over "int" or vice versa.

+1
source share
1 answer

The whim of the author <stdint.h>.

, int long ( , ), , [u]int_{,_fast,_least}32_t, .

, ; . int long, , . , , int32_t typedef ed int, long, :

#include <stdint.h>
#include <stddef.h>
int main(void) {
    int32_t *p32 = NULL;
    int  *ip = p32;
    long *lp = p32;
    return  0;
}

ip, lp, , int32_t. .

+5

All Articles