Mail Archives: djgpp/1999/05/18/16:50:53
ok, this is rather a philosophical question, but maybe someone could
help me: i found in my code book a way to avoid try/throw/catch when
allocating memory using new which returns simply 0 instead. it says:
void *operator new(size_t,const nothrow &) throw(); (and the new[]
operator too)
so i tried to write the following:
int *tab = new (nothrow()) int[nb];
after including <memory> or <new> (i dont see a difference) the
compiler reported:
Error: no match for call to `(nothrow_t) ()'
than i replaced the line by:
int *tab = new (nothrow) int[nb];
and the compiler accepted it.
first question: is this a fault in my codebook?
second: does this ever return 0 (NULL)?
thanx in advance
mimo
- Raw text -