宏观和preprocessor之间的区别 [英] Difference between macro and preprocessor

查看:108
本文介绍了宏观和preprocessor之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,的#define嗒嗒8 是一个宏。同时,是pre处理器指令。

From what I understand , #define blah 8 is a macro . While , # is the pre-processor directive .

我们可以说#包括,#如果的#ifdef等。也是宏,或者是他们叫别的东西?抑或是宏观只是仅用于#define语句的一个术语?

Can we say #include,#if,#ifdef,etc. are also macros , or are they called something else ? Or is it that macro is just a term used for #define statements only?

请如果我错了指正。

推荐答案

开始的行是的 preprocessing指令的。他们指示,告诉preprocessor做一些事情。

Lines that start with # are preprocessing directives. They are directives that tell the preprocessor to do something.

的#include #如果 #IFDEF 的#ifndef 的#else #elif指令 #ENDIF 的#define 和#undef #行 #ERROR 的#pragma 都是preprocessing指令。 (A仅含行也是preprocessing指令,但没有任何效果。)

#include, #if, #ifdef, #ifndef, #else, #elif, #endif, #define, #undef, #line, #error, and #pragma are all preprocessing directives. (A line containing only # is also a preprocessing directive, but it has no effect.)

的#define嗒嗒8 为preprocessing指令,它不是一个宏。 等等是一个宏。这的#define preprocessing指令定义了一个名为宏等等由令牌取代了类对象宏 8

#define blah 8 is a preprocessing directive, it is not a macro. blah is a macro. This #define preprocessing directive defines the macro named blah as an object-like macro replaced by the token 8.

这篇关于宏观和preprocessor之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆