g*********s 发帖数: 1782 | 1 the following code gives me warnings. what does it mean and does it matter?
inclass_mutex.cpp: In constructor ‘X::X(unsigned int)’:
inclass_mutex.cpp:8: warning: extended initializer lists only available with
-std=c++0x or -std=gnu++0x
inclass_mutex.cpp:8: warning: extended initializer lists only available with
-std=c++0x or -std=gnu++0x
#include
class X {
public:
X(unsigned int in_sz = 0): sz (in_sz)
{
buffer = new int[sz];
lock = PTHREAD_MUTEX_INITIALIZER;
// pthread_mutex_init(&lock, NULL); // this is ok.
}
~X()
{
if ( sz != 0 ) {
delete buffer;
}
}
private:
unsigned int sz;
int* buffer;
pthread_mutex_t lock;
}; |
t****t 发帖数: 6806 | 2 that macro (PTHREAD_....blahblah) is in the form of {....}. for c++98, you
can only use it in static objects. c++0x allow you to do it for auto objects.
with
with
【在 g*********s 的大作中提到】 : the following code gives me warnings. what does it mean and does it matter? : inclass_mutex.cpp: In constructor ‘X::X(unsigned int)’: : inclass_mutex.cpp:8: warning: extended initializer lists only available with : -std=c++0x or -std=gnu++0x : inclass_mutex.cpp:8: warning: extended initializer lists only available with : -std=c++0x or -std=gnu++0x : #include : class X { : public: : X(unsigned int in_sz = 0): sz (in_sz)
|
g*********s 发帖数: 1782 | 3 thx!
you
objects.
【在 t****t 的大作中提到】 : that macro (PTHREAD_....blahblah) is in the form of {....}. for c++98, you : can only use it in static objects. c++0x allow you to do it for auto objects. : : with : with
|