C预处理程序语句是否是C语言的一部分

C预处理程序语句是否是C语言的一部分

本文介绍了C预处理程序语句是否是C语言的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我记得我的一位教授在C语言入门课程中提出了一个要求。他表示, #define 预处理程序命令使程序员能够创建一个常量以供以后的代码使用,并且该命令是C语言的组成部分

I recall a claim made by one of my professors in an introductory C course. He stated that the #define preprocessor command enables a programmer to create a constant for use in later code, and that the command was a part of the C language.

/* Is this truly C code? */
#define FOO 42

由于这是入门编程班,我怀疑他只是简化了源文件和编译器之间的关系,但是尽管如此,我还是想验证一下我的理解。

Since this was in an introductory programming class, I suspect that he was merely simplifying the relationship between the source file and the compiler, but nevertheless I wish to verify my understanding.

预处理器语句是否完全独立于C语言(取决于(使用的特定编译器上)还是在 C99标准中明确描述了它们?出于好奇,K& R是否曾经提到预处理器宏?

Are preprocessor statements completely independent from the C language (dependent on the specific compiler used) or are they explicitly described in the C99 standard? Out of curiosity, did K&R ever mention preprocessor macros?

推荐答案

是的,该标准描述了预处理器。这是C语言的标准组成部分。

Yes, the standard describes the preprocessor. It's a standardized part of the C language.

请注意, #include 对于代码的模块化至关重要,是预处理程序指令。

Note that #include, which is essential for modularization of code, is a preprocessor directive.

在,该预处理器在6.10节中进行了描述。

In the publically-available draft of the C99 standard, the preprocessor is described in section 6.10.

这篇关于C预处理程序语句是否是C语言的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 08:34