Predefined macros are identifier constants automatically defined by the C preprocessor prior to the compilation phase. They provide metadata about the compilation environment, the current source file, and compiler compliance. The preprocessor substitutes these identifiers with specific string literals or integer constants during translation phase 4. By ISO C standard mandate, these macros are reserved. They cannot be undefined usingDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
#undef or redefined using #define.
Standard Predefined Macros (C89/C90)
The following macros are universally supported by any standard-compliant C compiler:__FILE__: Expands to a character string literal representing the presumed name of the current source file.__LINE__: Expands to a decimal integer constant representing the presumed current line number within the current source file.__DATE__: Expands to a character string literal representing the date of translation. The format is"Mmm dd yyyy"(e.g.,"Jan 01 2024"). If the day is less than 10, the first character ofddis a space.__TIME__: Expands to a character string literal representing the time of translation. The format is"hh:mm:ss".__STDC__: Expands to the integer constant1if the compiler implementation conforms to the ISO C standard.
Extended Standard Macros (C99 and Later)
Subsequent revisions of the C standard introduced additional predefined macros to expose environment and version details:__STDC_VERSION__: Expands to alonginteger constant indicating the specific ISO C standard version the compiler adheres to.199409L(C89 amendment 1)199901L(C99)201112L(C11)201710L(C18)
__STDC_HOSTED__: Expands to the integer constant1if the implementation is a hosted environment (has the full standard library available), or0if it is a freestanding environment.
Syntax and Expansion Visualization
The #line Directive Interaction
While predefined macros cannot be redefined via #define, the preprocessor’s internal state for __LINE__ and __FILE__ can be explicitly mutated using the #line directive.
Note on __func__
Introduced in C99, __func__ is frequently associated with predefined macros, but it is technically a predefined identifier, not a preprocessor macro. It is evaluated by the compiler, not the preprocessor. It behaves as if the following declaration were implicitly made immediately after the opening brace of a function:
Master C with Deep Grasping Methodology!Learn More





