9

There are a ton of drivers & famous applications that are not available in 64-bit. Adobe for instance does not provider a 64-bit Flash player plugin for Internet Explorer. And because of that, even though I am running 64-bit Vista, I have to run 32-bit IE. Microsoft Office, Visual Studio also don't ship in 64-bit AFAIK.

Now personally, I haven't had much problems building my applications in 64-bit. I just have to remember a few rules of thumb, e.g. always use SIZE_T instead of UINT32 for string lengths etc.

So my question is, what is preventing people from building for 64-bit?

4

8 回答 8

16

If you are starting from scratch, 64-bit programming is not that hard. However, all the programs you mention are not new.

It's a whole lot easier to build a 64-bit application from scratch, rather than port it from an existing code base. There are many gotchas when porting, especially when you get into applications where some level of optimization has been done. Programmers use lots of little assumptions to gain speed, and these are not always easy to quickly port to 64-bit. A few examples I've had to deal with:

  • Proper alignment of elements within a struct. As data sizes change, assumptions that certain fields in a struct will be aligned on an optimal memory boundary may fail
  • Length of long integers change, so if you pass values over a socket to another program that may not be 64-bit, you need to refactor your code
  • Pointer lengths change, as so hard to decipher code written be a guru that has left the company become a little trickier to debug
  • Underlying libraries will also need to have 64-bit support to properly link. This is a large part of the problem of porting code if you rely on any libraries that are not open source
于 2008-10-01T22:54:47.467 回答
5

除了@jvasak 的帖子中的内容之外,可能导致错误的主要内容:

  • 指针大于整数 - 大量代码假设大小相同。

请记住,Windows 甚至不允许应用程序(无论是 32 位还是 64 位)处理地址高于 0x7FFFFFFF(2GB 或以上)的指针,除非它们被特别标记为,"LARGE_ADDRESS_AWARE"因为许多应用程序会将指针视为在某些时候出现负值并跌倒。

于 2008-10-01T23:14:33.597 回答
5

我在将 C/C++ 代码移植到 64 位时遇到的最大问题是来自 3rd 方库的支持。例如,目前只有 32 位版本的 Lotus Notes API 和 MAPI,因此您甚至无法链接它们。

此外,由于您无法将 32 位 DLL 加载到 64 位进程中,因此您会再次尝试动态加载内容。我们在尝试支持 64 位下的 Microsoft Access 时再次遇到了这个问题。来自维基百科:

在可预见的未来,Jet 数据库引擎将保持 32 位。微软没有计划在 64 位版本的 Windows 下原生支持 Jet

于 2008-10-02T00:28:53.293 回答
3

Just a guess, but I would think a large part of it would be support - If Adobe compiles the 64 bit version, they have to support it. Even though it may be a simple compile switch, they'd still have to run through a lot of testing, etc, followed by training their support staff to respond correctly, when they do run into issues fixing them either results in a new version of the 32 bit binary or a branch in the code, etc. So while it seems simple, for a large application it can still end up costing a lot.

于 2008-10-01T22:43:38.740 回答
3

许多公司没有努力创建 64 位版本的另一个原因是他们根本不需要。

Windows 有 WoW64(Windows 上的 Windows 64 位),Linux 可以提供 32 位库和 64 位库。这两者都允许我们在 64 位环境中运行 32 位应用程序。

只要软件能够以这种方式运行,转换为 64 位的主要动力就没有了。

例外情况是设备驱动程序之类的东西,因为它们与操作系统更紧密地联系在一起,并且不能在基于 x86-64/AMD64 的 64 位操作系统提供的 32 位层中运行(IA64 无法做到这一点)我明白)。

我同意你对 Flash 播放器的看法,但我对 Adob​​e 没有更新这个产品感到非常失望。正如您所指出的,它在 64 位中无法正常工作,需要您运行 32 位版本的 Internet Explorer。

我认为这是 Adob​​e 的战略错误。必须为 flash player 运行 32 位浏览器对用户来说是一种不便,许多人不会理解这种解决方案。这可能会导致开发人员对使用闪存感到担忧。对于一个网站来说,最重要的事情是确保每个人都可以查看它,疏远用户的解决方案通常不受欢迎。Flash 的受欢迎程度是由它自己的受欢迎程度提供的,使用它的网站越多,系统上拥有它的用户就越多,系统上拥有它的用户越多,愿意使用它的网站就越多。

零售市场推动这些事情向前发展,当普通消费者购买新电脑时,他们不会知道他们不需要 64 位操作系统,他们也会购买它,因为他们听说它是最新的并且最伟大的事情,计算的未来,或者只是因为他们不知道其中的区别。

Vista 已经发布了大约 2 年,而 Windows XP 64 位在此之前就已经发布了。在我看来,如果他们想保住自己的市场,Flash 等主要技术不升级就太久了。这可能与 Adob​​e 接管 Macromedia 有关,这表明 Adob​​e 并不认为 Flash 是他们未来的一部分,我很难相信,因为我认为 Flash 和 Dreamweaver 是他们从 Macromedia 中获得的最重要的部分,但是为什么他们还没有更新呢?

于 2008-10-02T00:18:45.220 回答
2

It is not as simple as just flipping a switch on your compiler. At least, not if you want to do it right. The most obvious example is that you need to declare all your pointers using 64-bit datatypes. If you have any code which makes assumptions about the size of these pointers (e.g. a datatype which allocates 4 bytes of memory per pointer), you'll need to change it. All this needs to have been done in any libraries you use, too. Further, if you miss just a few then you'll end up with pointers being down-casted and at the wrong location. Pointers are not the only sticky point but are certainly the most obvious.

于 2008-10-01T22:56:51.953 回答
1

Primarily a support and QA issue. The engineering work to build for 64-bit is fairly trivial for most code, but the testing effort, and the support cost, don't scale down the same way.

On the testing side, you'll still have to run all the same tests, even though you "know" they should pass.

For a lot of applications, converting to a 64-bit memory model doesn't actually give any benefit (since they never need more than a few GB of RAM), and can actually make things slower, due to the larger pointer size (makes every object field twice as large).

Add to that the lack of demand (due to the chicken/egg problem), and you can see why it wouldn't be worth it for most developers.

于 2008-10-01T22:54:42.223 回答
0

Their Linux/Flash blog goes some way to explain why there isn't a 64bit Flash Player as yet. Some is Linux-specific, some is not.

于 2008-10-01T22:53:21.400 回答