XCode issues warning for my implementation of global operator new:
void *operator new(size_t blocksize);
It says: ‘operator new’ is missing exception specification ‘throw(std::bad_alloc)’
But my implementation does not intend to throw any exception, and I’d rather declare it as
void *operator new(size_t blocksize) throw();
However, the latter implementation leads to an error:
Exception specification in declaration does not match previous declaration
So, the question is: am I really forced (to calm down XCode compiler) to declare a custom ‘operator new’ as throw(std::bad_alloc) even if it wont throw any exception?
Yes you do:
http://developer.apple.com/library/mac/#technotes/tn2185/_index.html