On Sat, 7 Sep 2013, Marc Glisse wrote:
On Sat, 7 Sep 2013, Mike Stump wrote:
Can this throw:
void *operator new (long unsigned int s) {
return 0;
}
? Is this allowed to return 0?
I think using this function is illegal. It isn't marked noexcept, so it isn't
allowed to return 0.
And if I compile your code with gcc, I get nice warnings (though I get
them twice and the column number is not so good):
m.cc: In function 'void* operator new(long unsigned int)':
m.cc:2:12: warning: 'operator new' must not return NULL unless it is
declared 'throw()' (or -fcheck-new is in effect) [enabled by default]
return 0;
^
m.cc: At global scope:
m.cc:1:7: warning: unused parameter 's' [-Wunused-parameter]
void *operator new (long unsigned int s) {
^
--
Marc Glisse