Linux的32位应用程序移植到64位? [英] porting linux 32 bit app to 64 bit?
问题描述
我即将端口超大规模的应用到64位, 我注意到,在网上有一些物品演出 这种移植了很多陷阱, 我想知道是否有一个可以协助移植到64位的任何工具,这意味着 在找到需要code的地方被改变....也许与warnnings海合会启用......是不是不够好?有什么好?
i'm about to port very large scale application to 64 Bits, i've noticed in that in the web there some articles which shows many pitfalls of this porting , i wondered if there is any tool which can assist in porting to 64 bit , meaning finding the places in code that needs to be changed.... maybe the gcc with warnnings enabled... is it good enough ? is there anything better ?
编辑:大家好我搜索如果有的话,可能是一个完整的编译器工具,
我知道GCC可以ASIST,但我怀疑它会找到所有未移植的问题,
将在运行时被发现....也许静态code分析工具,它强调
移植到64位?
Guys i am searching for a tool if any that might be a complete to the compiler,
i know GCC can asist , but i doubt it will find all un portable problems that
will be discovered in run-time....maybe static code analysis tool that emphasize
porting to 64 bits ?
感谢
推荐答案
一个很好的工具,叫做的grep
;-) DO
A good tool is called grep
;-) do
grep -nH -e '\<int\>\|\<short\>\|\<long\>' *
和通过适当的替换这些基本整数类型的所有裸露的用途:
and replace all bare uses of these basic integer types by the proper one:
- 在数组的下标应
为size_t
- 指针类型转换应该是
uintptr_t形式
- 在指针的差异应该是
prtdiff_t
- 类型与宽度N的假设
应
uintN_t
- array indices should be
size_t
- pointer casts should be
uintptr_t
- pointer differences should be
prtdiff_t
- types with an assumption of width N
should be
uintN_t
等等,我可能忘记了一些。 然后的 GCC
上会告诉你所有的警告。你也可以使用铛
为编译器它提供了更多的诊断。
and so on, I probably forgot some. Then gcc
with all warnings on will tell you. You could also use clang
as a compiler it gives even more diagnostics.
这篇关于Linux的32位应用程序移植到64位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!