msvc9、iostream 和 2g/4g plus 文件
使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尽管您说您对使用“win32”调用“零”兴趣,但在这种情况下您陷入了进退两难的境地。
我将使用“win32”调用来实现我自己的文件 iostream 版本,该调用看起来和感觉都像 fstream 接口。 这很容易做到,我已经做过数百次了。
称其为“fstreamwin32”。
然后我会有一个头文件,它会执行以下操作:
然后我会在任何地方使用 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:
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.
我在这个主题上找到的另一个链接:
http://cplusplus.com/forum/general/6813/< /a>
Another link I found on this subject:
http://cplusplus.com/forum/general/6813/
我最终使用了 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.