How differently are Compiler directives and preprocessor directives handled by compiler
In C, I was wondering how differently compiler directives and preprocessor directives are handled/implemented by compiler such as GCC? Thanks!
By compiler directives, they are as in:
OpenMP (Open Multi-Processing) is an application programming interface (API) that supports multi-platform shared memory multiprocessing programming in C, C++, and Fortran on many architectures, including Unix and 开发者_如何学Python Microsoft Windows platforms. It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior.
The compiler handles preprocessor directives as specified in C99 section 6.10.
Compilers don't handle preprocessor directives; preprocessors do that. Once the preprocessor is done, it gives its output to the compiler, which can interpret compiler directives (like #pragma
s) as it sees fit.
As for the preprocessor, see Pete Wilson's answer. As for the #pragma
directive, Wikipedia has this to say:
The #pragma directive is a compiler specific directive which compiler vendors may use for their own purposes.
精彩评论