的#define标识符没有令牌 [英] #define IDENTIFIER without a token

查看:108
本文介绍了的#define标识符没有令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是下面的语句的意思是:

What does the following statement mean:

#define FAHAD

我所熟悉的,如语句:

I am familiar with the statements like:

#define FAHAD 1

但什么是没有道理的#define语句意味着什么?
难道它类似于一个恒定的定义是什么?

But what does the #define statement without a token signify? Is it that it is similar to a constant definition?

推荐答案

定义一个常数没有值作为一个标志为preprocessor,并可以像这样被使用:

Defining a constant without a value acts as a flag to the preprocessor, and can be used like so:

#define MY_FLAG
#ifdef MY_FLAG
/* If we defined MY_FLAG, we want this to be compiled */
#else
/* We did not define MY_FLAG, we want this to be compiled instead */
#endif

这篇关于的#define标识符没有令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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