I have a C++ codebase that has been around for a while (10+ years) and it compiles and runs fine, but I notice that when I compile it under OS/X 10.8.x (Mountain Lion), the compiler emits deprecation warnings about some of the Carbon functions it calls:
../system/SetupSystem.cpp:575:44: warning: 'UpTime' is deprecated: first
deprecated in OS X 10.8 [-Wdeprecated-declarations]
../system/SetupSystem.cpp:575:22: warning: 'AbsoluteToNanoseconds' is
deprecated: first deprecated in OS X 10.8 [-Wdeprecated-declarations]
../system/SystemInfo.cpp:249:25: warning: 'MPProcessors' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
I'd like to upgrade this codebase to the new Apple-approved way of doing things (and thus avoid the warnings and future pain if/when Apple finally removes these functions), but I can't figure out what the new standard is. I looked through the OS/X documentation at developer.apple.com, but either my searching skills are lacking or their documentation is, as I find next to nothing about these functions and nothing about their replacements.
Specific questions I have:
I've found usable replacements for the functions listed above:
#include <mach/mach_host.h> mach_msg_type_number_t infoCount = HOST_BASIC_INFO_COUNT; host_info(gHostPort, HOST_BASIC_INFO, (host_info_t)&hostInfo, &infoCount); int numProcessors = hostInfo.avail_cpus;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With