Re: why Obj-C
Re: why Obj-C
- Subject: Re: why Obj-C
- From: Jim Correia <email@hidden>
- Date: Tue, 9 Apr 2002 22:45:00 -0400
On Tuesday, April 9, 2002, at 05:09 PM, Brian Stern wrote:
This is simply not true. Operator new throws an exception on failure. A
constructor for a class written by a good C++ programmer will also throw
an
exception if the object cannot be constructed. As a result it is
impossible for a constructor to return a NULL pointer.
Be careful when you use superlatives.
It is true that the current standard says new should throw on failure.
This was not always the case.
The actual behavior depends on the "standard" C++ library that you are
using.
MSL used to let you control the behavior with preprocessor conditionals
(whether new returns NULL on failure, or throws a bad_alloc). Since it
ships as source, you can easily make current versions not throw a
bad_alloc exception if you have source code which requires that behavior.
Jim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.