14 KiB
[cpp.predefined]
15 Preprocessing directives [cpp]
15.12 Predefined macro names [cpp.predefined]
The following macro names shall be defined by the implementation:
-
__cplusplus
The integer literal 202302L. [Note 1: Future revisions of this document will replace the value of this macro with a greater value. â end note] -
The macros defined in Table 22 shall be defined to the corresponding integer literal. [Note 2: Future revisions of this document might replace the values of these macros with greater values. â end note]
-
DATE
The date of translation of the source file: a character string literal of the form"Mmm dd yyyy", where the names of the months are the same as those generated by theasctime function, and the first character ofdd is a space character if the value is less than 10. If the date of translation is not available, an implementation-defined valid date shall be supplied. -
FILE
The presumed name of the current source file (a character string literal).129 -
LINE
The presumed line number (within the current source file) of the current source line (an integer literal).130 -
STDC_EMBED_NOT_FOUND, STDC_EMBED_FOUND, and STDC_EMBED_EMPTY
The integer literals 0, 1, and 2, respectively. [Note 3: These represent values replaced from has-embed-expressions ([cpp.cond]). â end note] -
STDC_HOSTED
The integer literal 1 if the implementation is a hosted implementation or the integer literal 0 if it is a freestanding implementation ([intro.compliance]). -
STDCPP_DEFAULT_NEW_ALIGNMENT
An integer literal of type std::size_t whose value is the alignment guaranteed by a call to operator new(std::size_t) or operator new. [Note 4: Larger alignments will be passed tooperator new(std::size_t, std::align_val_t), etc. ([expr.new]). â end note] -
STDCPP_FLOAT16_T
Defined as the integer literal 1 if and only if the implementation supports the ISO/IEC 60559 floating-point interchange format binary16 as an extended floating-point type ([basic.extended.fp]). -
STDCPP_FLOAT32_T
Defined as the integer literal 1 if and only if the implementation supports the ISO/IEC 60559 floating-point interchange format binary32 as an extended floating-point type. -
STDCPP_FLOAT64_T
Defined as the integer literal 1 if and only if the implementation supports the ISO/IEC 60559 floating-point interchange format binary64 as an extended floating-point type. -
STDCPP_FLOAT128_T
Defined as the integer literal 1 if and only if the implementation supports the ISO/IEC 60559 floating-point interchange format binary128 as an extended floating-point type. -
STDCPP_BFLOAT16_T
Defined as the integer literal 1 if and only if the implementation supports an extended floating-point type with the properties of the typedef-name std::bfloat16_t as described in [basic.extended.fp]. -
TIME
The time of translation of the source file: a character string literal of the form"hh:mm:ss" as in the time generated by theasctime function. If the time of translation is not available, an implementation-defined valid time shall be supplied.
Table 22 — Feature-test macros [tab:cpp.predefined.ft]
| ð Macro name |
Value |
|---|---|
| ð __cpp_aggregate_bases |
201603L |
| ð __cpp_aggregate_nsdmi |
201304L |
| ð __cpp_aggregate_paren_init |
201902L |
| ð __cpp_alias_templates |
200704L |
| ð __cpp_aligned_new |
201606L |
| ð __cpp_attributes |
200809L |
| ð __cpp_auto_cast |
202110L |
| ð __cpp_binary_literals |
201304L |
| ð __cpp_capture_star_this |
201603L |
| ð __cpp_char8_t |
202207L |
| ð __cpp_concepts |
202002L |
| ð __cpp_conditional_explicit |
201806L |
| ð __cpp_constexpr |
202406L |
| ð __cpp_constexpr_dynamic_alloc |
201907L |
| ð __cpp_constexpr_exceptions |
202411L |
| ð __cpp_constexpr_in_decltype |
201711L |
| ð __cpp_constexpr_virtual_inheritance |
202506L |
| ð __cpp_consteval |
202211L |
| ð __cpp_constinit |
201907L |
| ð __cpp_contracts |
202502L |
| ð __cpp_decltype |
200707L |
| ð __cpp_decltype_auto |
201304L |
| ð __cpp_deduction_guides |
201907L |
| ð __cpp_delegating_constructors |
200604L |
| ð __cpp_deleted_function |
202403L |
| ð __cpp_designated_initializers |
201707L |
| ð __cpp_enumerator_attributes |
201411L |
| ð __cpp_expansion_statements |
202506L |
| ð __cpp_explicit_this_parameter |
202110L |
| ð __cpp_fold_expressions |
201603L |
| ð __cpp_generic_lambdas |
201707L |
| ð __cpp_guaranteed_copy_elision |
201606L |
| ð __cpp_hex_float |
201603L |
| ð __cpp_if_consteval |
202106L |
| ð __cpp_if_constexpr |
201606L |
| ð __cpp_impl_coroutine |
201902L |
| ð __cpp_impl_destroying_delete |
201806L |
| ð __cpp_impl_three_way_comparison |
201907L |
| ð __cpp_impl_reflection |
202506L |
| ð __cpp_implicit_move |
202207L |
| ð __cpp_inheriting_constructors |
201511L |
| ð __cpp_init_captures |
201803L |
| ð __cpp_initializer_lists |
200806L |
| ð __cpp_inline_variables |
201606L |
| ð __cpp_lambdas |
200907L |
| ð __cpp_modules |
201907L |
| ð __cpp_multidimensional_subscript |
202211L |
| ð __cpp_named_character_escapes |
202207L |
| ð __cpp_namespace_attributes |
201411L |
| ð __cpp_noexcept_function_type |
201510L |
| ð __cpp_nontype_template_args |
201911L |
| ð __cpp_nontype_template_parameter_auto |
201606L |
| ð __cpp_nsdmi |
200809L |
| ð __cpp_pack_indexing |
202311L |
| ð __cpp_placeholder_variables |
202306L |
| ð __cpp_pp_embed |
202502L |
| ð __cpp_range_based_for |
202211L |
| ð __cpp_raw_strings |
200710L |
| ð __cpp_ref_qualifiers |
200710L |
| ð __cpp_return_type_deduction |
201304L |
| ð __cpp_rvalue_references |
200610L |
| ð __cpp_size_t_suffix |
202011L |
| ð __cpp_sized_deallocation |
201309L |
| ð __cpp_static_assert |
202306L |
| ð __cpp_static_call_operator |
202207L |
| ð __cpp_structured_bindings |
202411L |
| ð __cpp_template_parameters |
202502L |
| ð __cpp_template_template_args |
201611L |
| ð __cpp_threadsafe_static_init |
200806L |
| ð __cpp_trivial_relocatability |
202502L |
| ð __cpp_trivial_union |
202502L |
| ð __cpp_unicode_characters |
200704L |
| ð __cpp_unicode_literals |
200710L |
| ð __cpp_user_defined_literals |
200809L |
| ð __cpp_using_enum |
201907L |
| ð __cpp_variable_templates |
201304L |
| ð __cpp_variadic_friend |
202403L |
| ð __cpp_variadic_templates |
200704L |
| ð __cpp_variadic_using |
201611L |
The following macro names are conditionally defined by the implementation:
-
STDC
Whether STDC is predefined and if so, what its value is, are implementation-defined. -
STDC_MB_MIGHT_NEQ_WC
The integer literal 1, intended to indicate that, in the encoding forwchar_t, a member of the basic character set need not have a code value equal to its value when used as the lone character in an ordinary character literal. -
STDC_VERSION
Whether STDC_VERSION is predefined and if so, what its value is, are implementation-defined. -
STDC_ISO_10646
An integer literal of the form yyyymmL (for example, 199712L). Whether STDC_ISO_10646 is predefined and if so, what its value is, are implementation-defined. -
STDCPP_THREADS
Defined, and has the value integer literal 1, if and only if a program can have more than one thread of execution.
The values of the predefined macros (except for__FILE__ and__LINE__) remain constant throughout the translation unit.
If any of the pre-defined macro names in this subclause, or the identifierdefined, is the subject of a#define or a#undef preprocessing directive, the program is ill-formed.
Any other predefined macro names shall begin with a leading underscore followed by an uppercase letter or a second underscore.
The presumed source file name can be changed by the #line directive.
The presumed line number can be changed by the #line directive.