I am using xcode 2.4.1 on tiger. When i do below everything is ok. when i do
pthread_mutex_t mute; ImageMan() { dibSize=0; mute = PTHREAD_MUTEX_INITIALIZER; }
I get these two errors
error: expected primary-expression before '{' token error: expected `;' before '{' token
I dont know why. However if i do pthread_mutex_t mute = PTHREAD_MUTEX_INITIALIZER; it works fine. Why?
-edit- I havent ran it but this seems to compile. Why? huh?
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; mute = mutex;
PTHREAD_MUTEX_INITIALIZERis a constant initializer, valid when in initialization only. It is a macro that doesn’t necessarily expand to an integral type.Your
mute=mutex;is invalid- instead you should use:or if you’re allocating mutexes dynamically: