msvc9、iostream 和 2g/4g plus 文件

发布于 2024-07-22 06:40:46 字数 540 浏览 3 评论 0原文

使用64位进行跨平台开发。 使用 gcc/linux 和 msvc9/server 2008。 最近刚刚在 Windows 上部署了一个客户,在一些升级测试中我发现虽然 std::streamoff 是 8 个字节,但在寻求超过 4G 时程序崩溃了。

我立即切换到 stlport,它解决了问题,但是 stlport 似乎还有其他问题。 STL 和 msvc9 真的那么糟糕吗,还是我遗漏了什么?

由于代码是跨平台的,我对使用任何 win32 调用的兴趣为零。

相关

Doing cross platform development with 64bit. Using gcc/linux and msvc9/server 2008.
Just recently deployed a customer on windows and during some testing of upgrades I found out that although std::streamoff is 8 bytes, the program crashes when seeking past 4G.

I immediately switched to stlport which fixes the problem, however stlport seems to have other issues. Is STL with msvc9 really that broken, or am I missing something?

Since the code is cross platform I have zero interest in using any win32 calls.

Related

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

锦爱 2024-07-29 06:40:46

尽管您说您对使用“win32”调用“零”兴趣,但在这种情况下您陷入了进退两难的境地。

我将使用“win32”调用来实现我自己的文件 iostream 版本,该调用看起来和感觉都像 fstream 接口。 这很容易做到,我已经做过数百次了。

称其为“fstreamwin32”。

然后我会有一个头文件,它会执行以下操作:

#ifdef WIN32
typedef fstreamwin32 fsteamnative;
#else
typedef fstream fsteamnative;
#endif

然后我会在任何地方使用 fsteamnative。 这样您就可以保持代码跨平台并仍然解决您的问题。

如果问题得到解决,您可以通过将 typedef 更改回使用 fstream typedef 来轻松删除“win32”解决方法。 这就是为什么许多跨平台代码库有很多间接级别(例如,通过使用自己的 typedef 来表示标准内容),因此它们要做这样的事情就必须更改大量代码。

Even though you say that you have "zero" interest in using "win32" calls, it situations like this your stuck between a rock and a hard place.

I would just implement my own version of a file iostream using the "win32" calls that looks and feels like the fstream interfaces. This is easy to do and I've done it hundreds of times.

Call it say 'fstreamwin32'.

Then I would have a header file that would do something like:

#ifdef WIN32
typedef fstreamwin32 fsteamnative;
#else
typedef fstream fsteamnative;
#endif

Then I would use fsteamnative everywhere. That way you keep your code cross platform and still solve your problem.

If the problem is ever fixed, you can easily remove your "win32" workaround by changing your typedef back to using fstream typedef. This is why lots of cross platform codebases have lots of levels of indirection (e.g. by using their own typedef's for standard stuff) so that they are do stuff like this would having to change a lot of code.

身边 2024-07-29 06:40:46

我在这个主题上找到的另一个链接:

http://cplusplus.com/forum/general/6813/< /a>

Another link I found on this subject:

http://cplusplus.com/forum/general/6813/

当爱已成负担 2024-07-29 06:40:46

我最终使用了 STLport。 与 STLport 最大的区别在于,一些在双精度数字乘法期间崩溃的单元测试现在可以工作并且这些单元测试通过了。 相对精度还存在一些其他差异,但这些差异似乎很小。

I ended up using STLport. The biggest difference with STLport being that some unit tests which crashed during multiplies of double precision numbers now work and those unit tests pass. There are some other differences with relative precision popping up but those seem to be minor.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文