如何检测CPU架构 [英] how to detect CPU architecture..

查看:68
本文介绍了如何检测CPU架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i必须检测CPU的类型。

无论是32位还是64位..

怎么能这样做..


有人可以帮帮我..


谢谢。

hi
i have to detect the type of CPU.
whether it is 32-bit or 64-bit..
how can this be done..

can anyone please help me..

thanks.

推荐答案

2006年8月31日23:14:23 -0700, rr ** ******@gmail.com 写道:
On 31 Aug 2006 23:14:23 -0700, rr********@gmail.com wrote:

> hi
我必须检测CPU的类型。无论是32位还是64位..
怎么能这样做..

任何人都可以帮助我..

谢谢。
>hi
i have to detect the type of CPU.
whether it is 32-bit or 64-bit..
how can this be done..

can anyone please help me..

thanks.



标准C没有提供任何方法来检测CPU的类型是否为32位或64位甚至8-位或16位或128位。由于这个

新闻组是关于标准C的,这里没有人可以真正帮助你。


-

jay


rr ******** @ gmail.com 写道:
rr********@gmail.com wrote:

i必须检测CPU的类型。

无论是32位还是64位..

如何做到这一点..
i have to detect the type of CPU.
whether it is 32-bit or 64-bit..
how can this be done..



它不可能。 CPU为8位。


Richard





(嗯,它可能是。我仍然有类似的计算机。并定义

类型。并解释你想知道的原因。你可能_think_你需要

to,但你可能也错了。)

It can''t. The CPU is 8-bit.

Richard






(Well, it could be. I still have computers like that. And define "the
type". And explain why you want to know. You probably _think_ you need
to, but you''re equally probably mistaken.)


如果你使用Unix,尝试在gcc宏中使用ULONG_MAX。

或sizeof(长):4位为32位,8位为64位拱。

Try to use ULONG_MAX in gcc macro if you use Unix.
or sizeof(long): 4 for 32bit, 8 for 64bit arch.


这篇关于如何检测CPU架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆