Implementation defined behavior control
Implementation defined behavior is controlled by
Lprefix (if any), the outer quotes, and leading/trailing whitespace from string-literal, replaces each
\, then tokenizes the result (as in translation stage 3), and then uses the result as if the input to
Pragma directive controls implementation-specific behavior of the compiler, such as disabling compiler warnings or changing alignment requirements. Any pragma that is not recognized is ignored.
The ISO C++ language standard does not require the compilers to support any pragmas. However, several non-standard pragmas are supported by multiple implementations:
ISO C language standard requires that C compilers support the following three pragmas, and some C++ compiler vendors support them, to varying degrees, in their C++ frontends:
where arg is either
ON, informs the compiler that the program will access or modify floating-point environment, which means that optimizations that could subvert flag tests and mode changes (e.g., global common subexpression elimination, code motion, and constant folding) are prohibited. The default value is implementation-defined, usually
), and |x+iy| = √x2
, despite the possibility of intermediate overflow. In other words, the programmer guarantees that the range of the values that will be passed to those function is limited. The default value is
The behavior of the program is undefined if any of the three pragmas above appear in any context other than outside all external declarations or preceding all explicit declarations and statements inside a compound statement.
#pragma once is a non-standard pragma that is supported by the vast majority of modern compilers. If it appears in a header file, it indicates that it is only to be parsed once, even if it is (directly or indirectly) included multiple times in the same source file.
Standard approach to preventing multiple inclusion of the same header is by using include guards:
#ifndef FILENAME_H #define FILENAME_H // contents of the header #endif /* FILENAME_H */
So that all but the first inclusion of the header in any translation unit are excluded from compilation.
With #pragma once, the same header appears as
#pragma once // contents of the header
Unlike header guards, this pragma makes it impossible to erroneously use the same macro name in more than one file. On the other hand, since with #pragma once files are excluded based on their filesystem-level identity, this can't protect against including a header twice if it exists in more than one location in a project.
|This section is incomplete|
C documentation for Implementation defined behavior control