
Signature
The best intentions in the world don't make a flawed argument magically valid.
Gregory Weston wrote
(in article
<uce-1D1078.21251922122006@comcast.dca.giganews.com>):
>> How would you determine the CPU type/model information?
>>
[quoted text clipped - 10 lines]
> There's the Mac OS Gestalt() function, an in particular the
> gestaltNativeCPUtype selector.
Digging further, it looks like the sysctl() stuff is the most
direct way of getting at all this information. AIUI, Gestalt()
is just a more convulated way to get to the same basic data, as
provided via sysctl -a from the command line.
> This kind of thing should really only be used for informational
> purposes, though.
Yes, I am writing code specifically to determine the underlying
hardware platform, for informational purposes.

Signature
Lefty
All of God's creatures have a place..........
.........right next to the potatoes and gravy.
See also: http://www.gizmodo.com/gadgets/images/iProduct.gif
Gregory Weston - 24 Dec 2006 01:49 GMT
> >> Independent of compiler options, I'd like to know if the
> >> underlying hardware is PPC32, PPC64, IA32, or X86-64 (down the
[quoted text clipped - 8 lines]
> is just a more convulated way to get to the same basic data, as
> provided via sysctl -a from the command line.
There's some overlap between what can be determined via Gestalt and by
sysctl, but there's a LOT that Gestalt can tell you that sysctl can't
and I _think_ some in the other direction as well. For your particular
question I don't consider Gestalt to be more or less convoluted than
sysctl.
G

Signature
The best intentions in the world don't make a flawed argument magically valid.
David C. - 26 Dec 2006 17:38 GMT
> There's some overlap between what can be determined via Gestalt and by
> sysctl, but there's a LOT that Gestalt can tell you that sysctl can't
> and I _think_ some in the other direction as well. For your particular
> question I don't consider Gestalt to be more or less convoluted than
> sysctl.
Also, note that Gestalt is the preferred MacOS API for this.
sysctl() is the UNIX method, but it is far from portable. The sysctl()
parameter names used by Mac OS are different from the ones used on (for
example) Linux, Solaris, HP-UX, etc.
On some operating systems, they even vary across different revisions of
the kernel. (For example, Linux's sysctl() parameters have changed
quite a bit moving from the 2.0 to 2.2 to 2.4 to 2.6 kernels.)
In other words, code that uses sysctl will not be portable to other UNIX
systems, so you really gain nothing over using the Mac OS APIs (that is,
Gestalt).
And Gestalt should be backward-compatible with most earlier versions of
Mac OS (I think it was first introduced in System 7.)
-- David