64bit 编程

暂时把 ASM 去掉以后, 希望能在 AMD64 上能让 mac-port 跑起来, 结果是段错误, 查到估计跟指针有关系, 想到在 SourceForge 上还有好几个有关 AMD64 的 bug : 1385806, 1348818, 1423861, 也有人提供了相关的 patch, 可以解决在非 Windows 系统上的问题.

但是现在我在考虑支持 MinGW, 而且已经通过简单的测试了(关闭汇编), 所以仅仅用以上 patch 不能兼顾 Windows 和其他. 这是由于数据模型的问题, 现在 64bit 模型常见的有两种: LP64 和 LLP64. 前者由绝大多数 Unix 系统支持, 而 Windows 支持后者. 这两者主要的不同就是 long 的长度, 在前者中为 64 位, 而在后者中仍为 32 位, 而指针长度都为 64 位. 所以不能简单的用 long 来代替原来的 int, 估计得分情在 Unix 下和 Windows 下分别用 long 和 long long 来替换了. 等测试结果出来再看看.

现在在读一些有关 64 位移植方面的文章, 感觉还不是很清晰, 得再多读一些, 多实践一些.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • You can use BBCode tags in the text.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
   ___   __   __              _                        __     _ 
/ _ \ \ \ / / __ __ __| | _ __ ___ _ __ / /_ / |
| | | | \ V / \ \ / / / _` | | '_ ` _ \ | '_ \ | '_ \ | |
| |_| | | | \ V / | (_| | | | | | | | | |_) | | (_) | | |
\__\_\ |_| \_/ \__,_| |_| |_| |_| | .__/ \___/ |_|
|_|
Enter the code depicted in ASCII art style.