Add new comment

According to gcc 4.1 manual,

According to gcc 4.1 manual, __sync_add_and fetch is builtin for this version, so it should works on 4.2 too.

I have not old Xcode on hands, only Xcode4/Xcode5 (llvm based), but this code compiles and links fine on my FreeBSD with gcc 4.2.1 (in both 32-bit and 64-bit mode):

int main()
{
 
 int _exitflag=0;
 if( __sync_add_and_fetch(&_exitflag,0))
        return 1;
 return 0;
}

May be, you need to specify processor target (-march=core2duo because OS X requires at least core2duo)

-- Alex Tutubalin