Re: is auto_ptr part of STL?
- From: "Alex Blekhman" <tkfx.N05P4M@xxxxxxxxx>
- Date: Fri, 2 Jun 2006 11:58:53 +0300
ultranet wrote:
Look, nowadays almost nobody cares about VC6 anymore.My company uses VC6, and no current plans to upgrade.
This is sad. You can nag your management until they decide
to upgrade. I don't know the situation in your company, it
can be that using VC6 is right and justified decision.
However, as time goes by, maintaining VC6 can become
eventually more expensive than upgrade to more compliant
compiler/library.
HavingThinking like this might be a reason of a lot of crashes,
that said, even less people care about esoteric throw
specifications of abandoned pre-standard compiler. It's
very rare situation when you write special handling for
`operator new' failure. Most of the time you just let
the exception to propagate up the stack. If `operator
new' fails, then it's a sign that you're already
severely messed up.
IMHO.
No, you should handle crashes and exit gracefully. Just let
`operator new' return NULL, then on first access to this
pointer you'll get access violaton. handle this access
violation as any other exception (i.e., log it, save
everything you can and exit with nice message box to user).
Think about it. Allocation fails. What now? How many more
instructions can you safely to execute until another
exception? What's the state of CRT allocator? How did you
get to situation where `operator new' fails? These are very
difficult questions nad most likely you won't be able to
answer them at runtime at all. That's why Herb Sutter in his
article says that when `operator new' fails you cannot do
much anyway. What you _can_ do is to save as much as
possible of user data and exit immediately until even
greater damage is done.
.
- References:
- Re: is auto_ptr part of STL?
- From: Alex Blekhman
- Re: is auto_ptr part of STL?
- Prev by Date: Re: Why can't open other com port
- Next by Date: Re: Database ODBC problem
- Previous by thread: Re: is auto_ptr part of STL?
- Next by thread: Re: is auto_ptr part of STL?
- Index(es):
Relevant Pages
|