您可以在#define宏名称中使用a.b表示法吗? [英] Can you use a.b notation in a #define macro name?

查看:88
本文介绍了您可以在#define宏名称中使用a.b表示法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Visual Studio 2008或2010声明一个定义,如下所示:

I want to declare a define, using Visual Studio 2008 or 2010, like that:

#define a.b c.d

我得到以下错误:

错误C2008:.":宏定义中出乎意料

error C2008: '.' : unexpected in macro definition

我看到可以创建这样的定义:

I see that I am allowed to create a define like this:

#define a c.d

宏名称中是否应该允许使用 a.b 表示法?

Is the a.b notation supposed to be allowed in the macro name?

推荐答案

宏与标识符具有相同的命名规则集.实际上,宏名称​​是标识符.

Macros has same set of rules for naming, as do identifiers. In fact, macro-names are identifiers.

所以

  • 它们不能包含点.
  • 它们可以,只能包含字母,数字和下划线.没有其他的.但是,它们不能 以数字开头.
  • They cannot contain dot.
  • They can consist of only alphabet, digits, and underscore. Nothing else. They cannot start with a digit, however.

这篇关于您可以在#define宏名称中使用a.b表示法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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