是否有可能重新定义{和}在C 2 [英] is it possible to redefine { and } in C?
本文介绍了是否有可能重新定义{和}在C 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有你做的东西没有办法像...
Is there any way you do something like...
#define { { printf("%s,%s",_FUNCTION_, _LINE_); {
这将无法编译。但我不知道是否有某种诡计,以有效获取相同的功能? (比写一个工具,在preprocessing一步钩等)
this won't compile. But I'm wondering if there is some kind of trick to effectively get the same functionality? (other than writing a tool to hook at the preprocessing step)
这样做的问题是如何让一个贫穷的芒code覆盖率琢磨。
The point of doing this is a pondering on how to get a poor mans code coverage.
推荐答案
这当然不是与宏可能。宏的名称必须是一个标识符。括号字符是标点符号,没有标识。
It's certainly not possible with a macro. The name of a macro must be an identifier. The brace characters are punctuators, not identifiers.
这篇关于是否有可能重新定义{和}在C 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文