是否存在用于将 C++ 代码移植到 64 位的任何自动转换工具? [英] Do any automated conversion tools exist for porting C++ code to 64-bit?

查看:25
本文介绍了是否存在用于将 C++ 代码移植到 64 位的任何自动转换工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究将大量(> 10M 行)C++ 代码移植到 64 位的方法.我研究了静态代码分析器和编译器标志,现在我正在研究可以进行常见、重复更改的宏或其他工具.

I'm researching methods to port a large (>10M lines) amount of C++ code to 64-bit. I have looked at static code analyzers and compiler flags, and I am now looking at macros or other tools that can make common, repetitive changes.

我已经编写了一些正则表达式来查看它们在实践中的效果,并且正如预测的那样,它们非常有效.也就是说,首先构建表达式需要一段时间,所以我想看看是否有任何可以自动执行更改的此类表达式或软件工具的列表.

I've written a few regular expressions to see how well they work in practice, and as predicted, they're quite effective. That said, it takes a while to build the expressions in the first place, so I'd like to see if there are any lists of such expressions or software tools that can perform changes automatically.

以下几行是要匹配和修复的代码的原型示例.(澄清一下,这些行并不是代表单个代码块,而是从不同地方拉出的行.)

The following lines are prototypical examples of code to be matched and fixed. (To clarify, these lines are not meant to represent a single block of code, but instead are lines pulled from different places.)

int i = 0;
long objcount;
int count = channels.count(ch);
for (int k = 0; k < n; k++) { /*...*/ }

目标不是将代码彻底移植到 64 位,而是执行第一遍代码以减少需要手动检查的代码量.遗漏一些必要的更改是可以的,并且可能做出一些错误的更改是可以的,但应该尽量减少这些更改.

The objective is not to thoroughly port code to 64-bit, but instead to perform a first pass over the code to reduce the amount of code that needs to be manually inspected. It's okay for some needed changes to be missed, and it's probably okay for some wrong changes to be made, but those should be minimized.

Visual Studio 是将用于转换工作的 IDE,因此与 VS 配合良好的东西是一个加分项.成本不是问题.

Visual Studio is the IDE that will be used for conversion work, so something that works well with VS is a plus. Cost is not an issue.

推荐答案

Rexexp 的误报率很高;根据定义,正则表达式"无法解析上下文无关语言,例如 C++.此外,正则表达式不能考虑账户类型信息;是

Rexexps suffer from a high false positive rate; by definition, a "regular expression" cannot parse a context free langauge such as C++. Futhermore, regexps cannot take into account type information; is

   fooT i=0;

好的,对于一些 typedef'd 脚?最后,正则表达式不能改变代码;您可能会考虑 Perl 或 SED(使用正则表达式来驱动更改),但是由于正则表达式的误报,您会得到错误的更改.在 10M SLOC 上,这可不好玩;5% 的错误率意味着可能需要手动修复 50,000 行代码.

ok, for some typedef'd fooT? Finally, a regexp cannot change code; you might consider Perl or SED (using regexps to drive changes), but you'll get erroneous changes due to the false positives of regexps. At 10M SLOC, that can't be fun; a 5% error rate means possibly 50,000 lines of code to fix by hand.

您可以考虑使用程序转换工具.这样的引擎在语言结构上运行,而不是文本,更复杂的版本知道范围、类型和符号的含义(例如,到底什么是 fooT?).它们使您能够使用目标语言的表面语法编写特定于语言和上下文的模式,并提出结构正确的代码更改.这使得大规模代码更改的可靠应用成为可能.

You might consider a program transformation tool. Such engines operate on language structures, not text, and more sophisticated versions know scopes, types, and the meaning of symbol (e.g., what is fooT, exactly?). They offer you the ability to write langauge- and context-specific patterns, and propose structurally correct code changes, using the surface syntax of the target language. This enables the reliable application of code changes on scale.

我们的 DMS 软件再造工具包及其 C++前端已被用于以语法和类型准确的方式对大型C++系统进行大量更改.(参见 Akers, R.、Baxter, I.、Mehlich, M.、Ellis, B.、Luecke, K.,案例研究:通过自动程序转换重新设计 C++ 组件模型,信息与软件技术 49(3):275-291 2007.)

Our DMS Software Reengineering Toolkit with its C++ Front End has been used to carry out massive changes to large C++ systems in a syntax- and type-accurate way. (See Akers, R., Baxter, I., Mehlich, M. , Ellis, B. , Luecke, K., Case Study: Re-engineering C++ Component Models Via Automatic Program Transformation, Information & Software Technology 49(3):275-291 2007.)

这篇关于是否存在用于将 C++ 代码移植到 64 位的任何自动转换工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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