Name

#pragma

Synopsis

The #pragma directive is implementation-specific. It can be used to define any preprocessor directives desired for a given compiler.

Syntax:

#pragma command

Any compiler that does not recognize command simply ignores the #pragma directive.

Example:

#pragma pack(1)

The Microsoft C compiler interprets this directive as an instruction to align the members of structures on byte boundaries, so that no unnamed gaps occur. (Other pragmas supported by that compiler are pack(2) and pack(4), for word and double-word alignment.)

ANSI C99 introduces the standard pragmas CX_LIMITED_RANGE , FENV_ACCESS , and FP_CONTRACT , which are described in the upcoming section Section 1.18.

Predefined standard macros

There are eight predefined macros in C, whose names begin and end with two underline characters. They are described in Table 1-21.

Table 1-21. Predefined standard macros

Macro

Replacement value

_ _LINE_ _

The number of the line (within the given source file) in which the macro _ _LINE_ _ appears

_ _FILE_ _

The name of the source file in which the macro_ _FILE_ _ appears

_ _func_ _ (*)

The name of the function in which the macro _ _func_ _ appears

_ _DATE_ _

The date of compilation, in the format “Mmm dd yyyy”. Example: “Dec 18 2002”

_ _TIME_ _

The time of compilation, in the format “hh:mm:ss”

_ _STDC_ _

The integer constant 1 if the compiler conforms to the ANSI standard

_ _STD_HOSTED_ _ (*)

The integer constant 1 if the current implementation is ...

Get C Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.