Is there a way to determine how many cores a machine has from C/C++ in a platform-independent way? If no such thing exists, what about determining it per-platform (Windows/*
On linux the best programmatic way as far as I know is to use
sysconf(_SC_NPROCESSORS_CONF)
or
sysconf(_SC_NPROCESSORS_ONLN)
These aren't standard, but are in my man page for Linux.