Hi, i've just tried to output
std::thread::hardware_concurrency on my laptop under different Oses and was rather suprised.
and if cygwin with gcc 5.4 returns '1' i wasn't suprised as multithreading under cygwin it is a big question. But when debian x64 returns same '1' i decided to ask there.
My laptop is K52DR-A1 which equipped with AMD Phenom II Triple-Core N830. DEbian sees all three cores:
found error in program. Output should be std::thread::hardware_concurrency() instead std::thread::hardware_concurrency. And only clang notices that. g++ said nothing :(
When compiling with the GNU compiler,
explicitly demand conformance to standard C++ (-std=c++14 -pedantic-errors)
and enable all warnings (-Wall -Wextra).
clang++
------
main.cpp:6:18: warning: address of function 'std::thread::hardware_concurrency' will always evaluate to 'true' [-Wpointer-bool-conversion]
std::cout << std::thread::hardware_concurrency << '\n' ;
~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:6:18: note: prefix with the address-of operator to silence this warning
std::cout << std::thread::hardware_concurrency << '\n' ;
^
&
1 warning generated.
g++
----
main.cpp: In function 'int main()':
main.cpp:6:31: warning: the address of 'static unsigned int std::thread::hardware_concurrency()' will always evaluate as 'true' [-Waddress]
std::cout << std::thread::hardware_concurrency << '\n' ;
^~~~~~~~~~~~~~~~~~~~