c++gccopenmpc-preprocessor

How to distinguish preprocessor and compiler directives?


I have been told that #pragma omp directive in GCC is directive of the compiler, and is not directive of the preprocessor.

Is it correct?

How to distinguish preprocessor's and compiler's directives?


Solution

  • Here is a quote from gcc docs

    This manual documents the pragmas which are meaningful to the preprocessor itself. Other pragmas are meaningful to the C or C++ compilers. They are documented in the GCC manual.

    Acccording to that, there are preprocessor pragmas and non-preprocessor pragmas.

    How to distinguish preprocessor's and compiler's directives?

    Preprocessor directives are specified in the C standard, compiler directives are described in the compiler manual.

    About your edit, the linked page does not mention #pragma omp and if you combine that with the quote above, I would reason that the pragma is not for the preprocessor. It is definitely compiler specific.