ç通用宏的名字 - GCC -fextended的标识符 [英] C universal macro names - gcc -fextended-identifiers

查看:307
本文介绍了ç通用宏的名字 - GCC -fextended的标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找我怎么能写的标识符名字像['字符或#。

I'm looking for how can I write identifiers name with characters like [ ' " or #.

每当我试图做到这一点,我给了错误:

Everytime that I try to do that, I give the error:

错误:宏名必须是标识符

error: macro names must be identifiers

但了解GCC,我发现这个选项:

But learning about gcc, I found this option:

-fextended的标识符

-fextended-identifiers

但似乎并不喜欢的工作,我想请,有人知道如何实现这一目标?

But it seems not working like I wanted, please, somebody know how to accomplish that?

推荐答案

标识符不能包括这些字符。它被定义在语言语法的方式,标识是字母,数字或下划线(并且不能以数字开头,以避免与litteral数字模糊)。

Identifiers can't include such characters. It is defined that way in the language syntax, identifiers are letters, digits or underline (and mustn't begin with a digit to avoid ambiguity with litteral numbers).

如果有可能,这将与C编译器(使用[数组)和C preprocessor语法(使用#)发生冲突。扩展标识符扩展只允许使用由语言的语法里面的标识符非禁止的字符(UNI基本上code外文字母,等等)。

If it was possible this would conflict with the C compiler (that uses [ for arrays) and C preprocessor syntax (that uses #). Extended identifiers extension only allow using characters non forbidden by the language syntax inside identifiers (basically unicode foreign letters, etc.).

但如果你真的,真的要做到这一点,空话禁止你preprocess源文件用自己的扩展宏preprocessor,实际上是创建一个新的C状的语言。这看起来像一个可怕的想法,但它不是真的很难做到。然后你就会看到很快通过自己为什么这不是一个好主意......

But if you really, really want to do this, nothings forbids you to preprocess your source files with your own "extended macro preprocessor", practically creating a new "C like" language. That looks like a terrible idea, but it's not really hard to do. Then you'll see soon enough by yourself why it's not a good idea...

这篇关于ç通用宏的名字 - GCC -fextended的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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