关于Windows XP SP2 x86上不支持的两个C++11

来源:互联网 发布:mysql主键自增长 重置 编辑:程序博客网 时间:2024/06/07 01:03

这个年代了还有人用Windows XP SP2 x86,我也是醉了。。。

这个bug估计很少有人遇到吧。

std::mutex和std::thread不支持在Windows XP SP2 x86上运行,会报入下图的错误GetLogicalProcessorInformation找不到:


我是在visula studio 2015上面选择Visual Studio 2015 - Windows XP (v140_xp)这种模式和运行库选择:多线程 (/MT) 的时候遇到的。

去掉std::mutex和std::thread以后,就可以在Windows XP SP2 x86上运行了。

c++ lamada表达式貌似可以随便使用。


看了微软的2015 c++for xp的介绍:

https://msdn.microsoft.com/en-us/library/jj851139.aspx

C++ runtime support

Along with the Windows XP platform toolset, the C Runtime Library (CRT), Standard Template Library (STL), Active Template Library (ATL), Concurrency Runtime Library (ConCRT), Parallel Patterns Library (PPL), Microsoft Foundation Class Library (MFC), and C++ AMP (C++ Accelerated Massive Programming) library include runtime support for Windows XP and Windows Server 2003. For these operating systems, the minimum supported versions are Windows XP Service Pack 3 (SP3) for x86, Windows XP Service Pack 2 (SP2) for x64, and Windows Server 2003 Service Pack 2 (SP2) for both x86 and x64.

估计std::mutex和std::thread最低需要Windows XP Service Pack 2 (SP2) for x64。没找到x64的虚拟机。。。


另外还有一个奇葩的函数:_stat

struct _stat fileStat;int result = _stat(directoryPath.c_str(), &fileStat);return (result == 0) && (fileStat.st_mode & _S_IFDIR);
上面这个return 在某些情况下在Windows XP SP2上面和在Visula Studio 2013编译出来的某些情况下会返回失败,但是目录命名存在。

本人对这个函数理解不是很深刻。猜测可能是目录下面有文件(非文件夹)的原因。




0 0
原创粉丝点击