# of processors
David Talkington
dtalk at u.washington.edu
Mon Jan 20 21:25:35 PST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Mark L. Chang said on Mon, 20 Jan 2003:
> #include <unistd.h>
> #include <stdio.h>
>
> main()
> {
> printf("%d\n", sysconf(_SC_NPROCESSORS_CONF));
> }
Hmm... I think I'd opt for this instead at Line 6:
printf("%ld\n", sysconf(_SC_NPROCESSORS_CONF));
So that you'd get the expected result even on the occasional Uber
Computer with a 64 bit long and more than 2147483647 processors.
;-)
- -d
- --
David Talkington
dtalk at u.washington.edu
PGP key: http://staff.washington.edu/dtalk/AED8EEA8.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6
iD8DBQE+LNnXKguwn67Y7qgRAnEdAJ47wKZ6KcWvs7/XRNNofOgFi/bpGgCgpLGS
otjMRaickAtgI8ozB5p5eEQ=
=6NZM
-----END PGP SIGNATURE-----
More information about the Linux
mailing list