This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Fastest minimum-width integer types and limits macros
Ian Lance Taylor schrieb:
> Gunther Nikl <gnikl@users.sourceforge.net> writes:
>
>> Is there a special requirement about the value of the limits
>> macros for fastest minimum-width integers? Eg. would it be legal
>> to use the limits of a a "signed char" if int_fast8_t is defined
>> in terms of an int? Or is it required to use the proper limit of
>> int?
>
> I don't understand what you mean. Can you show us some example code
> that you are uncertain about?
Here is an example for int_fast8_t:
typedef signed char int_fast8_t;
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
Now if int_fast8_t uses "int" as underlying type like this:
typedef int int_fast8_t;
which value is its MIN/MAX macros supposed to have? Is it
allowed to use the same "char" limits as above or do I need
to use
#define INT_FAST8_MIN INT32_MIN
#define INT_FAST8_MAX INT32_MAX
in that case?
So this is not about user code but an implementation question.
Thank you,
Gunther Nikl