Variable definition in structure if() can't receive type struct. if(struct passwd*pwd(getpwuid(...)))return; error: expected primary-expression before ‘struct’ error: expected ‘)’ before ‘struct’
That is neither C nor C++.
Code { struct passwd*pwd(getpwuid(...)); if(pwd)return true;} is still compiled. Code if(struct passwd*pwd=getpwuid(...))return; compiled too. But if(struct passwd*pwd(getpwuid(...)))return; will not. Who is right?
G++ is right a declaration in a selection-statement (if or switch) must be of the form: if ( type-specifier id = initializer ) or in C++0x: if ( type-specifier id { init } ) See 6.4 in the C++ standard