cc-preprocessorpragma

Is the C preprocessor part of the C standard?


I just know that #pragma once is not part of the C standard but rather part of the preprocessor.
In that case, does that make the preprocessor not part of the C standard?
So, are the C programming language and the C preprocessor different entities?


Solution

  • The preprocessor is very much a part of the C standard — see C11 §6.10 Preprocessing directives for the details in C11. The C standard and the preprocessor are not different entities. C23 has many new features in the preprocessor — perhaps the most significant is __VA_OPT__ (though the #embed directive takes up the most space in the standard).

    You are correct that #pragma once is not part of Standard C. However, a number of compilers provide support for it. That means those compilers provide an extension to the C standard — and any compiler usually provides a number of extensions (often a large number of extensions) to the C standard.