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/*
Unrelated to C++, but on Linux I usually do:
grep processor /proc/cpuinfo | wc -l
Handy for scripting languages like bash/perl/python/ruby.