On (20 Apr 97) Kurt Kuzba wrote to Thomas Maeder...
KK> Doesn't new already return NULL, or 0, on failure?
No.
KK> It does in VC++ 4.0.
It certainly shouldn't, at least by default. It should throw an
exception upon failure. Offhand I'm not certain what it does if you
disable exception handling completely, but at that point we're certainly
no longer talking about what it "should" do (according to the draft
standard) we're only talking about what one particular implementation
does.
To be more accurate, when new fails, it calls the new handler function,
and the default new handler function is what throws the exception. This
does mean that it's easy to change things so it doesn't throw an
exception anymore, if you prefer.
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|