English 中文(简体)
是否有第32条或第64条轨道信息?
原标题:Qt get system 32bit or 64 bit info?

我是用Qt书写的软件,我的任务之一是判断Windows OS是否为32比特,还是64比特,然后根据这一事实进行以下业务。

However, when I was trying "QSysInfo::WordSize", it always return 32 while I was actually running on Windows 7-64 bit OS. I also tried

#ifdef _WIN32
return 32;
#elif _WIN64
return 64;

这也使32人返回。

Actually Qt is 32bit in my system. Is that the problem? How can I get the actual word size of Windows?

成就

最佳回答
问题回答

这应在任何舱位环境中进行,包括 在任何系统上使用“分类登记册”(IOW,有适当的固定记忆空间):

uint32_t archwidth = sizeof(int *);    // arch width in bytes
uint32_t archbits  = 8 * archwidth;    // arch width in bits

这里的机制是:

关于64轨道结构(如XEON),CPU将使用8个星号(64-bit)点,因此archwidth将返回8;archbits 然后是8*64>。

关于32个轨道结构(如68,000个),万国邮联将使用4个星号(32个轨道)点,因此<代码>twidth将返回4;archbits 然后是4*<8,或32

关于16轨结构(如6809),万国邮联将使用2个星号(16个轨道)点,因此<代码>群岛/代码>将返回<>2<>/strong>;<代码>>斜线/代码>则改为2*<8/strong>,或16





相关问题
Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Programmatically detect Windows cluster configuration?

Does anyone know how to programatically detect that a Windows server is part of a cluster? Further, is it possible to detect that the server is the active or passive node? [Edit] And detect it from ...

get file icon for Outlook appointment (.msg)

I ve read Get File Icon used by Shell and the other similar posts - and already use SHFileInfo to get the associated icon for any given extension, and that works great. However, Outlook uses ".msg" ...

Identifying idle state on a windows machine

I know about the GetLastInputInfo method but that would only give me the duration since last user input - keyboard or mouse. If a user input was last received 10 minutes ago, that wouldn t mean the ...

Terminating a thread gracefully not using TerminateThread()

My application creates a thread and that runs in the background all the time. I can only terminate the thread manually, not from within the thread callback function. At the moment I am using ...