Site icon Learn C++

What Are Function Macros For Integer Constants?

What Are Function Macros For Integer Constants

In C++ coding, there are function macros for the fixed-width integer type that expands to an integer constant expression having the value specified by its argument. Their type is the promoted type of std::int_least8_t, std::int_least16_t, std::int_least32_t, and std::int_least64_t and unsigned versions of these types respectively. In this post, we explain these function macros for integer constants in Modern C++.

What are function macros for signed integer constants?

Here are the function macros for the fixed-width integer type that expands to an integer constant expression having the value specified by its argument. Their type is the promoted type of std::int_least8_tstd::int_least16_tstd::int_least32_t and std::int_least64_t respectively,

Fixed Width Integer TypesDescription
INT8_Cexpands to an integer constant whose type is std::int_least8_t
INT16_Cexpands to an integer constant whose type is std::int_least16_t
INT32_Cexpands to an integer constant whose type is std::int_least32_t
INT64_Cexpands to an integer constant whose type is std::int_least64_t

What are function macros for unsigned integer constants?

Here are the function macros for the fixed-width integer type that expands to an integer constant expression having the value specified by its argument. Their type is the promoted type of std::uint_least8_tstd::uint_least16_tstd::uint_least32_t and std::uint_least64_t respectively.

Fixed Width Integer TypesDescription
UINT8_Cexpands to an unsigned integer constant whose type is std::uint_least8_t
UINT16_Cexpands to an unsigned integer constant whose type is std::uint_least16_t
UINT32_Cexpands to an unsigned integer constant whose type is std::uint_least32_t
UINT64_Cexpands to an unsigned integer constant whose type is std::uint_least64_t

What are other function macros for integer constants?

INTMAX_C function macro, expands to an integer constant whose type is std::intmax_t,

Fixed Width Integer TypesDescription
INTMAX_Cmin. value of 8 bits signed integer type

UINTMAX_C function macro, expands to an integer constant whose type is std::ıintmax_t,

Fixed Width Integer TypesDescription
UINTMAX_Cmin. value of 8 bits signed integer type

If you are looking more about Integer Constants there are more details about them, https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Integer_Constants
If you are looking more about Declared Constants, you can follow this link: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Declared_Constants

Is there a simple C++ example of using function macros for integer constants?

Here is a very simple C++ example of how you can use function macros for integer constants.

[crayon-6763eccdb4dec012302595/]

Is there a full C++ example of how to use function macros for integer constants?

Here is a full C++ example of how to use function macros for integer constants.

[crayon-6763eccdb4df5555985448/]

C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

Exit mobile version