• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Detecting CPU type
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting CPU type


  • Subject: Re: Detecting CPU type
  • From: Damien Bobillot <email@hidden>
  • Date: Fri, 16 Sep 2005 13:38:19 +0200


Le 16 sept. 05 à 10:41, Peter a écrit :

Hello,

I would like to find out CPU Type (PPC or x86), Gestalt seems to be discontinued and sysctl seems not too friendly (hw.cputype: 18 ???). Please let me know which is function or Cocoa class to be use.

The CPU type is known at compilation time : gcc compiles to PPC or x86. So, it's possible to hardcode CPU Architecture detection :


bool isPPC() {
#ifdef __ppc__
    return true;
#else
    return false;
#end
}

bool isx86() {
#ifdef __i386__
    return true;
#else
    return false;
#end
}

You'll find sample codes to get some hardware informations using the mach API at :
http://www.cocoadev.com/index.pl?HowToGetHardwareAndNetworkInfo


--
Damien Bobillot

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Detecting CPU type (From: Peter <email@hidden>)

  • Prev by Date: Font scaling and string size problem?!?
  • Next by Date: Re: Detecting CPU type
  • Previous by thread: Re: Detecting CPU type
  • Next by thread: Re: Detecting CPU type
  • Index(es):
    • Date
    • Thread