0

I went through the header file stdint.h and found that the entire header file gives an alias to already existing data types, and then used min after the underscore to set limits #define INT8_MIN (-128)for min #define INT8_MAX 128for max(or so I assume).

How does that work i.e int8_t is dependent on INT8_MIN and MAX?

0

the #define INT8_MIN -128 and #define INT8_MAX 127 (not 128) are not aliases to datatypes. these are constant definitions. they respectively define the minimum and maximum values for an 8-bit int to be INT8_MIN and INT8_MAX (i.e., gives these constant values descriptive names). this allows you to do something as follows:

int8_t min = INT8_MIN;
int8_t max = INT8_MAX;

which improves code readability. the code above, after the preprocessing phase, gets substituted with

int8_t min = -128;
int8_t max = 127;

see http://www.cprogramming.com/reference/preprocessor/define.html!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .