您可以在#define宏名称中使用a.b表示法吗?

编程入门 行业动态 更新时间:2024-10-23 13:25:00
本文介绍了您可以在#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表示法吗?

本文发布于:2023-11-30 00:43:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648158.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:您可以   名称   define

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!