Re: Summary of C++0x Feature Availability
On 2010-03-19, Scott Meyers <NeverRead@aristeia.com> wrote:
johannes.dahlstrom@gmail.com wrote:
g++ 4.4 has threads, atomics, locks, mutexes, and condition variables.
Hmmm. Given
#include <thread>
#include <mutex>
int main()
{
std::thread t;
std::mutex m;
}
I get:
g++ (TDM-1 mingw32) 4.4.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
threads.cpp: In function 'int main()':
threads.cpp:6: error: 'thread' is not a member of 'std'
threads.cpp:6: error: expected ';' before 't'
threads.cpp:7: error: 'mutex' is not a member of 'std'
threads.cpp:7: error: expected ';' before 'm'
....
Any idea why our results are different?
Probably because thread support is not implemented for mingw32 yet. It
does seem to be available in e.g. Linux version of g++ and, I guess, other
platforms using POSIX threads.
The example above compiles for me with g++ 4.4.3 (Debian 4.4.3-3) provided
-std=c++0x is specified (otherwise the following error occurs:
/usr/include/c++/4.4/c++0x_warning.h:31:2: error: #error This file requires
compiler and library support for the upcoming ISO C++ standard, C++0x. This
support is currently experimental, and must be enabled with the -std=c++0x
or -std=gnu++0x compiler options.
)
Regards,
VZ
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]