C/C ++表达式运算符优先级的括号计算器 [英] Parenthesis calculator for C/C++ expressions operator precedence
问题描述
在将一些混淆的C代码移植到C ++之后(即 Fairy-Max 国际象棋引擎(由Harm Geert Muller撰写),我收到很多类似以下警告:
After porting some obfuscated C code into C++ (namely Fairy-Max chess engine by Harm Geert Muller), I get lots of warnings similar to these:
'&'操作数中的比较括号[-Werror =括号]
suggest parentheses around comparison in operand of '&' [-Werror=parentheses]
在'&'操作数中'+'周围的最括号
suggest parentheses around '+' in operand of '&'
While turning off the warnings is not an option, the solution is to add parenthesis in expressions according to the operator precedence.
例如:
if(z&S&&!ab&K==INF&d>2&v>V&v<Beta){
需要转变成这样:
if((z&S) && ((!ab)&(K==INF)&(d>2)&(v>V)&(v<Beta))) {
但是手动执行此操作非常耗时.
But doing this manually is quite time-consuming.
我尝试使用此去模糊工具,该工具内部使用了clang-format
,但是它不会在表达式中添加括号...
I tried to use this deobfuscation tool, which uses clang-format
internally, but it does not add parenthesis into expressions...
问题
是否有一个工具(最好在线)可以将C/C ++表达式作为输入并返回无警告的等效表达式作为输出?
Is there a tool (preferably online) that can take a C/C++ expression as an input and return a warnings-free equivalent expression as an output?
推荐答案
我一直想要一个网络版本,但是上一次我试图让Geordi在我的VPS上工作时,由于Haskell依赖古怪,我惨败了.可能有一天再给它一次.
I've long wanted a web version, but last time I tried to get Geordi working on my VPS I failed miserably due to Haskell dependency gubbins. May give it another go one day.
同时,您可以登录到Freenode IRC 和/msg geordi --precedence *p->data
(例如).您会打开一个私人消息标签,其中显示结果(例如*(p->data)
).随时在该标签中继续发送--precedence <expression>
请求.
Meanwhile, you can log onto Freenode IRC and /msg geordi --precedence *p->data
(for example). You'll get a private message tab open up with the result (e.g. *(p->data)
). Feel free to keep sending --precedence <expression>
requests in that tab.
这篇关于C/C ++表达式运算符优先级的括号计算器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!